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
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
using namespace std;

int nextInt() { int n; scanf("%d", &n); return n; }

int main() {
	int n = nextInt();
	vector<int> res(n + 1, 0);
	unordered_map<int, int> cnt;
	for (int i = 0; i < n; ++i)
		++cnt[nextInt()];
	for (auto it = cnt.begin(); it != cnt.end(); ++it) {
		int x = it->second;
		for (int i = 1; i <= x; ++i)
			res[i] += x / i;
	}
	for (int i = 1; i < n; ++i)
		printf("%d ", res[i] * i);
	printf("%d\n", res[n] * n);
	return 0;
}