from collections import Counter n = int(input()) z = list(map(int, input().split())) c = Counter(z) c2 = Counter(c.values()) keys = sorted(c2.keys(), reverse=True) for i in range(1,n+1): s = 0 for j in range(len(keys)): if keys[j] < i: break s += c2[keys[j]] * (keys[j] // i) * i print (s, end=' ')
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from collections import Counter n = int(input()) z = list(map(int, input().split())) c = Counter(z) c2 = Counter(c.values()) keys = sorted(c2.keys(), reverse=True) for i in range(1,n+1): s = 0 for j in range(len(keys)): if keys[j] < i: break s += c2[keys[j]] * (keys[j] // i) * i print (s, end=' ') |