1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>

using namespace std;
int main(){
    int n,t;
    scanf("%d", &n);
    vector<int> v(n, 0);
    for(int i=0; i < n; i++){
        scanf("%d", &t);
        v[t]++;
    }
    sort(v.begin(), v.end());
    int res=0, sum=0, i=n-1;

    while(sum < n){
        sum += 2*v[i]-1;
        i--;
        res++;
    }
    
    cout <<res;
}