n = int(input()) cities = [int(x) for x in input().split()] stamps = {} for c in cities: if c in stamps: stamps[c] += 1 else: stamps[c] = 1 k = [0] * n for s in stamps: for i in range(1,stamps[s]+1): if stamps[s] % i == 0: k[i-1] += stamps[s] else: k[i-1] += (stamps[s] // i) * i print(" ".join(str(x) for x in k))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | n = int(input()) cities = [int(x) for x in input().split()] stamps = {} for c in cities: if c in stamps: stamps[c] += 1 else: stamps[c] = 1 k = [0] * n for s in stamps: for i in range(1,stamps[s]+1): if stamps[s] % i == 0: k[i-1] += stamps[s] else: k[i-1] += (stamps[s] // i) * i print(" ".join(str(x) for x in k)) |