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
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

#define pb push_back

typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    int n;
    cin >> n;
    map<int,int> mp;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        mp[x]++;
    }
    vector<int> fr;
    for (auto& it : mp) fr.emplace_back(it.second);
    sort(fr.begin(), fr.end());
    int pt = 0;
    for (int i = 1; i <= n; i++) {
        while (pt < (int)fr.size() && fr[pt] < i) pt++;
        int ans = 0;
        for (int j = pt; j < fr.size(); j++) {
            ans += fr[j] / i;
        }
        cout << ans * i << " ";
    }
    return 0;
}