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

#define loop(i, a, b) for(int i = a; i <= b; i++)
#define loop_rev(i, a, b) for(int i = a; i >= b; i--)
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define eb emplace_back
#define pb push_back

using ui = uint32_t;
using ll = int64_t;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n; cin >> n;

  vector<int> a(n);

  loop(i, 0, n-1) {
    cin >> a[i];
  }

  sort(all(a));
  vector<int> cnt(n);
  int curr = (-1), pr = (-1);

  loop(i, 0, n-1) {
    if(a[i] != pr) ++curr;
    ++cnt[curr], pr = a[i];
  }

  sort(all(cnt), greater<int>());

  loop(k, 1, n) {
    int res = 0;
    while(!cnt.empty() && cnt.back() < k) cnt.pop_back();
    for(int c : cnt) res += (c / k) * k;
    cout << res << ' ';
  }
  cout << '\n';

}