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

using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);


	int n,a;
	unordered_map<int, int> stamps;

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		stamps[a]++;
	}

	map<int,int,std::greater<int>> c;
	for (auto s: stamps)
		c[s.second]++;

	for (int i = 1; i <= n; i++)
	{
		int sum{};

		for (auto st: c)
		{
			if (st.first < i) break;

			sum += st.first / i * i * st.second;
		}
		cout << sum << ' ';
	}

	return 0;
}