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
46
47
48
49
50
51
52
#include <iostream>
#include <cstdlib>
#include <map>
using namespace std;

int tab[300001], n;


int compare(const void* a, const void* b)
{
	const int* x = (int*) a;
	const int* y = (int*) b;

	if (*x < *y)
		return 1;
	else if (*x > *y)
		return -1;

	return 0;
}

int main() 
{
	int i, i_max, x, nr;
	map <int, int> a;
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> x; a[x]++;
	}

   map<int, int>::iterator it;
   i_max = 0;
   for(it=a.begin(); it!=a.end(); ++it){
//      cout << it->first << " => " << it->second << '\n';
      tab[i_max++] = it->second;
   }
	qsort(tab, i_max + 1,sizeof(int),compare);
//   for(i = 0; i < i_max; i++) cout << tab[i] << '\n';
	cout << n;
   for (int k = 2; k <= n ; k++)
   {
   		nr = 0; i = 0;
   		while (tab[i] >= k) 
   			nr += tab[i++] / k * k;
   		cout << " " << nr;
   }

   return 0;
}