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
#include <bits/stdc++.h>
using namespace std;
const int L = 300'001;
//const int L = 308'946;
int result[L] = { 0 };

int main() {
//	ifstream cin("tests/0a.in");
//	ifstream cin("tests/1b.in");
//	ifstream cin("tests/1c.in");

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);
	int a, n;
	map<int, int> counter;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		counter[a]++;
	}

//	for (auto it : counter) {
//		cout << it.first << " " << it.second << endl;
//	}

	for (auto it : counter) {
		int k = it.second;
		for (int i = 1; i <= k; i++) {
			result[i] += k - (k % i);
		}
	}

	for (int i = 1; i <= n; i++) {
		cout << result[i] << " "; // prints
	}
	cout << endl; // prints
	return 0;
}