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
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	int no_numbers = 0;
	vector<int> A;
	unordered_map<int, int> place;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		if (place.find(a) == place.end()) {
			place.insert({ a,no_numbers });
			A.push_back(1);
			no_numbers++;
		}
		else {
			A[place[a]]++;
		}
	}
	sort(A.begin(), A.end(), greater<int>());
	vector<int> result;
	int m = A.size();
	for (int k = 1; k <= n; k++)
	{
		result.push_back(0);
		int j = 0;
		while (j < m && A[j] >= k) {
			
			result[k - 1]+= A[j] - (A[j] % k);
			j++;
		}
	}
	for (auto i : result) {
		cout << i <<" ";
	}
}