from collections import Counter
n = int(input())
stamps = [int(x) for x in input().split()]
counts = Counter(stamps)
sorted_counts = counts.most_common()
for i in range(1, n+1):
sum = 0
for ele in sorted_counts:
tmp = ele[1] - (ele[1] % i)
sum += tmp
if tmp == 0:
break
print(sum, end=' ')
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | from collections import Counter n = int(input()) stamps = [int(x) for x in input().split()] counts = Counter(stamps) sorted_counts = counts.most_common() for i in range(1, n+1): sum = 0 for ele in sorted_counts: tmp = ele[1] - (ele[1] % i) sum += tmp if tmp == 0: break print(sum, end=' ') |
English