Count frequencies of each color. Each pair is freq divided by 2. Sum the pairs.
Input
9 10 20 20 10 10 30 50 10 20
Output
3