AmazonOA #78
Find Minimum Groups (Security Grade Grouping)
估计中等可在线判题
Each group may only contain servers of the same security level, and the largest and smallest group sizes may differ by at most 1. Find the minimum number of groups.
输入格式
The first line contains n (1..100000), and the second line contains n levels (1..1000000).
输出格式
Output a single integer answer.
样例 1
输入:
5
1 1 1 2 2
输出:
2
样例 2
输入:
3
1 2 3
输出:
3
样例 3
输入:
5
7 7 7 7 7
输出:
1
样例说明
Example 1: two groups of sizes 3 and 2 suffice, so the answer is 2. Example 2: different levels can only form one group each, so the answer is 3. Example 3: servers all at the same level can be placed in one group, so the answer is 1.