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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>

using namespace std;


int min_cuts(vector<int> values, int n) {
    sort(values.begin(), values.end(), greater<int>());

    int counter = 0;
    int coverage = 2*values[0] - 1;
    // cout << coverage << endl;
    while (coverage < n) {
        counter++;
        coverage += 2*values[counter] - 1;
        // cout << coverage << endl;
    }

    return counter + 1;
}



int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);

    map<int, int> counter;

    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        int in;
        cin >> in;
        if (counter.find(in) == counter.end()) {
            counter[in] = 1;
        } else {
            counter[in]++;
        }
    }

    vector<int> values;

    for (const auto& [key, value] : counter) {
        values.push_back(value);
    }
    cout << min_cuts(values, n) << endl;

    return 0;
}