#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
    int n; cin >> n;
    vector<int> wiktor (n+1, 0);
    for(int i = 0; i < n; i++)
    {
        int temp; cin >> temp;
        wiktor[temp]++;
    }
    priority_queue<int> wystapieniaUWU;
    for(int i = 0; i < n; i++)
    {
        if(wiktor[i] > 0) wystapieniaUWU.push(wiktor[i]);
    }
    int result = 1;
    int size = n;
    while(wystapieniaUWU.top()*2 <= size)
    {
        size -= (2*wystapieniaUWU.top() - 1);
        wystapieniaUWU.pop();
        result++;
    }
    cout << result << endl;
}
        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 26 27 28 29 30 31 32  | #include<iostream> #include<vector> #include<string> #include<math.h> #include<map> #include<queue> #include<algorithm> using namespace std; int main() { int n; cin >> n; vector<int> wiktor (n+1, 0); for(int i = 0; i < n; i++) { int temp; cin >> temp; wiktor[temp]++; } priority_queue<int> wystapieniaUWU; for(int i = 0; i < n; i++) { if(wiktor[i] > 0) wystapieniaUWU.push(wiktor[i]); } int result = 1; int size = n; while(wystapieniaUWU.top()*2 <= size) { size -= (2*wystapieniaUWU.top() - 1); wystapieniaUWU.pop(); result++; } cout << result << endl; }  | 
            
        
                    English