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
#!/usr/bin/env python3

import sys
from collections import Counter
import numpy as np


def f(nums):
    c = Counter(nums)
    arr = np.array(list(c.values()))
    arr.sort()
    done = 0
    while True:
        k = len(arr)
        if k == 0:
            return done
        if arr[-1] <= 1 or k == 1:
            return k + done
        m = arr[-1] - 1
        i = 0
        while m > 0 and i < (k - 1):
            if arr[i] > m:
                arr[i] -= m
                break
            m -= arr[i]
            i += 1
        arr = arr[i:-1]
        done += 1


def main():
    _ = int(sys.stdin.readline())
    nums = [int(s) for s in sys.stdin.readline().split()]
    print(f(nums))


if __name__ == "__main__":
    main()