454. Distribute Candies
EasyHash Set
You have n candies (n is even) and may eat n/2 of them. Print the maximum number of different types you can eat.
Input format
Line 1: n Line 2: n candy types
Output format
The maximum number of types.
Example 1
Input
6 1 1 2 2 3 3
Output
3
Example 2
Input
4 1 1 2 3
Output
2
Constraints
2 ≤ n ≤ 10⁴
Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.
Loading the MyLoginn IDE…