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
#include <bits/stdc++.h>

using namespace std;

vector<int> grpCnt(const vector<int>& srt) {
    vector<int> cnt;
    for (int i = 0; i < srt.size(); ) {
        int c = 1;
        int j = i + 1;
        while (j < srt.size() && srt[i] == srt[j]) {
            ++c;
            ++j;
        }
        cnt.push_back(c);
        i = j;
    }
    return cnt;
}

int main() {
    int n;
    cin >> n;
    vector<int> stm(n);
    for (int& s : stm) {
        cin >> s;
    }
    
    sort(stm.begin(), stm.end());
    vector<int> cnt = grpCnt(stm);
    sort(cnt.begin(), cnt.end(), greater<int>());
    
    for (int k = 1; k <= n; ++k) {
        int tot = 0;
        for (int c : cnt) {
            if (c < k) break;
            tot += (c / k) * k;
        }
        cout << (k == 1 ? n : tot) << " ";
    }
    
    cout << endl;
    return 0;
}