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
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 300005;

int n, i, res, add, a;
map<int, int> m, m2;
map<int, int>::iterator it, itS;

int main() {
scanf("%d", &n);
for (i=0;i<n;i++) {
	scanf("%d", &a);
	m[a]++;
}
for (auto& w : m) m2[w.second]++;
itS = m2.begin();
for (i=1;i<=n;i++) {
	res = 0;
	while (itS != m2.end() && itS->first < i) itS++;
	it = itS;
	while (it != m2.end()) {
		res = res + (it->first - it->first % i) * it->second;
		it++;
	}
	printf("%d ", res);
}
printf("\n");
return 0;
}