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
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

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

  int n;
  std::cin >> n;

  std::map<int, int> counted;
  for (int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    ++counted[x];
  }

  std::vector<long> results(n, 0);
  for (auto [_, count] : counted)
    for (int k = 1; k <= count; ++k)
      results[k - 1] += count - (count % k);

  for (int k = 1; k <= n; ++k)
    std::cout << results[k - 1] << ' ';

  std::cout << '\n';

  return 0;
}