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
// Autor: Nicolas Wochnik
#include <algorithm>
#include <iostream>
#include <vector>

std::vector<long> stamps;
std::vector<long> repeats;
std::vector<long> answer;

void count_repeats() {
  std::sort(stamps.begin(), stamps.end());
  long repeat = 1;

  for (size_t i = 1; i < stamps.size(); ++i) {
    if (stamps[i - 1] != stamps[i]) {
      repeats.push_back(repeat);
      repeat = 0;
    }

    repeat++;
  }

  repeats.push_back(repeat);
}

void solve() {
  answer = std::vector<long>(stamps.size(), 0);

  for (auto repeat : repeats) {
    for (long k = 1; k <= repeat; ++k) {
      answer[k - 1] += repeat - (repeat % k);
    }
  }
}

int main() {
  size_t n;
  std::cin >> n;

  stamps = std::vector<long>(n);

  for (auto &stamp : stamps) {
    std::cin >> stamp;
  }

  count_repeats();
  solve();

  for (auto var : answer) {
    std::cout << var << " ";
  }
  std::cout << "\n";

  return 0;
}