1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>t(n+1),lval(n+1);
    for(int i=0;i<n;i++){
        cin>>t[i];
        lval[t[i]]++;
    }
    sort(lval.begin(),lval.end());
    int curn=n;
    int wyn=0;
    for(int i=n;i>=0;i--){
        curn-=(2*lval[i]-1);
        wyn++;
        if(curn<=0){
            break;
        }
    }
    cout<<wyn;
}