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
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <unordered_map>

void solve(const int n, const std::unordered_map<int, int>& counter) {
  std::unordered_map<int, int> data;
  for (const auto& [value, count] : counter) {
    for (int i = 1; i <= count; ++i) {
      data[i] += count - count % i;
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", data[i]);
  }
  printf("\n");
}

int main() {
  int n, value;
  std::unordered_map<int, int> counter;
  scanf("%d\n", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &value);
    counter[value]++;
  }
  solve(n, counter);
}