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

#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

map<int, int> M;

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	for(int i=0;i<n;i++) {
		int x;
		cin >> x;
		M[x]++;
	}
	vector<int> v;
	for(pii x:M) {
		v.pb(x.nd);
	}
	sort(all(v));
	for(int i=1;i<=n;i++) {
		int pre = 0;
		int ans = 0;
		for(int j=i;j<=n+i;j+=i) {
			int s = -1;
			int e = sz(v);
			while(e-s>1) {
				int m = (e+s)/2;
				if(v[m]<j) s = m;
				else e = m;
			}
			ans += (e-pre)*(j-i);
			pre = e;
		}
		cout << ans << " ";
	}
	cout << "\n";
}