#CCBCHBAHAI0000173. Ghép đôi tất (Sales by Match)
Ghép đôi tất (Sales by Match)
Sales by Match
Source: HackerRank
Version: Phuoc Hung OJ Extended
Problem
There are socks. Sock has color ID . Two socks form a pair if and only if their colors are equal, and each sock can be used in at most one pair.
If color occurs times, it contributes
pairs. Compute the total number of pairs.
Input
- The first line contains .
- The second line contains .
Output
Print the total number of pairs.
Subtasks
Subtask 1 (20 points): and .
Subtask 2 (30 points): and .
Subtask 3 (50 points): and .
Example
Input
9
10 20 20 10 10 30 50 10 20
Output
3
Explanation
Color 10 makes two pairs and color 20 makes one pair, for a total of three.