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
#include <bits/stdc++.h>

using namespace std;

#ifdef D
#define DEBUG(x)        \
    do {                \
        x               \
        cout.flush();   \
    } while (0)
#else
#define DEBUG(x)
#endif

using ll = long long;
using pii = pair<int, int>;

const int NMAX = 3e5 + 7;

int n, a;
map<int, int> m, quants;
int r[NMAX];

// int fast_read() {
// #define CU c = getchar_unlocked()
//     int x = 0;
//     char c;
//     while(isspace(CU)) {}
//     while(isdigit(c)) {
//         x = 10 * x + c - '0';
//         CU;
//     }
//     return x;
// #undef CU
// }

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

    cin >> n;
    // n = fast_read();

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

    for (auto it = m.begin(); it != m.end(); ++it) {
        quants[it->second]++;
    }

    for (auto it = quants.begin(); it != quants.end(); ++it) {
        for (int k = 1; k <= n; ++k) {
            r[k] += (it->first - it->first % k) * it->second;
        }
    }

    for (int k = 1; k <= n; ++k) {
        cout << r[k] << " ";
    }

    return 0;
}