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
#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, a) for (int i = 0; i < (a); i++)
#define rep1(i, a) for (int i = 1; i <= (a); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const int MAX_N = 3e5 + 5;
int res[MAX_N];
int main() {
    // ios_base::sync_with_stdio(0);
    // cin.tie(0);
    int n;
    cin >> n;
    map<int, int> m; // ile danego typu
    rep(i, n) {
        int x;
        cin >> x;
        m[x]++;
    }
    map<int, int> m2; // ile danego typu, ile takich typów
    for (auto [a, b] : m) {
        m2[b]++;
    }
    for (auto [a, b] : m2) {
        rep1(i, a) { res[i] += b * (a - a % i); }
    }
    rep1(i, n) cout << res[i] << ' ';
}