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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>


using namespace std;

//const int max_size = 300005;

int n;

map<int,int> m;
vector<int> v;

void print_vector()
{
    for (auto e : v) {
        printf(" %d", e);
    }
    printf("\n");
}

int calc_res(int k)
{
        int res = 0;

        for(const int& e : v) {
                if (e < k) {
                        return res;
                }
                res += (e / k) * k;
        }
        return res;
}

int main()
{
        int a;

        scanf("%d\n", &n);

        for(int i = 0; i < n; ++i) {
		scanf("%d", &a);
                if (m.contains(a)) {
                        m[a]++;
                } else {
                        m[a]=1;
                }
	}

        for(auto const& [key, val] : m) {
                v.push_back(val);
        }

        sort(v.begin(), v.end(), greater<int>());
//        print_vector();

        printf("%d", n);
        for(int i = 2; i <= n; ++i) {
                printf(" %d", calc_res(i));
        }
        printf("\n");

        return 0;
}