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
n_input = input()
numbers_input = input()

n = int(n_input)
numbers_integers = [int(a) for a in numbers_input.split()]

scores = [0]*n
for x in range(n):
        scores[numbers_integers[x]-1] += 1

min_sequnces = 0

max_score = max(scores) 
if max_score > n/2:
    print(1)
elif max_score == 1:
    print(n)
else:
    scores = [i for i in scores if i != 0]
    scores.sort(reverse=True)

    while max_score > 1:
        removed = scores[0]
        min_sequnces += 1
        for x in range(removed-1):
            if len(scores) > 0:
                if scores[-1] == 1:
                    scores.pop()
                else:
                    scores[-1] -= 1
        scores.pop(0)
        if len(scores) > 0:
            max_score = max(scores)
        else:
            max_score = 0
        
    min_sequnces += len(scores)
    print(min_sequnces)