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
def groupScores(scores):
    d = {}
    for score in scores:
        d.setdefault(score, 0)
        d[score] += 1
    return d


def lid():
    n = int(input())
    a = list(map(int, input().split()))
    values = list(groupScores(a).values())
    values.sort(reverse=True)
    groups = 0
    while n > 0:
        pop = values[groups]
        n -= pop + pop - 1
        groups += 1
    print(groups)

def __main__():
    lid()


__main__()