There are *n* pictures delivered for the new exhibition. The *i*-th painting has beauty *a*<sub class="lower-index">*i*</sub>. We know that a visitor becomes happy every time he passes from a painting to a more beautiful one.

We are allowed to arranged pictures in any order. What is the maximum possible number of times the visitor may become happy while passing all pictures from first to last? In other words, we are allowed to rearrange elements of *a* in any order. What is the maximum possible number of indices *i* (1 ≤ *i* ≤ *n* - 1), such that *a*<sub class="lower-index">*i* + 1</sub> &gt; *a*<sub class="lower-index">*i*</sub>.
The first line of the input contains integer *n* (1 ≤ *n* ≤ 1000) — the number of painting.

The second line contains the sequence *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 1000), where *a*<sub class="lower-index">*i*</sub> means the beauty of the *i*-th painting.
In the first sample, the optimal order is: 10, 20, 30, 40, 50.

In the second sample, the optimal order is: 100, 200, 100, 200.
5
20 30 10 50 40
4
4
200 100 100 200
2
10
2 2 2 2 2 2 2 2 2 2
0
1
1000
0
2
444 333
1
100
9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 98 21 14
95
1
995
0
10
103 101 103 103 101 102 100 100 101 104
7
20
102 100 102 104 102 101 104 103 100 103 105 105 100 105 100 100 101 105 105 102
15
20
990 994 996 999 997 994 990 992 990 993 992 990 999 999 992 994 997 990 993 998
15
100
1 8 3 8 10 8 5 3 10 3 5 8 4 5 5 5 10 3 6 6 6 6 6 7 2 7 2 4 7 8 3 8 7 2 5 6 1 5 5 7 9 7 6 9 1 8 1 3 6 5 1 3 6 9 5 6 8 4 8 6 10 9 2 9 3 8 7 5 2 10 2 10 3 6 5 5 3 5 10 2 3 7 10 8 8 4 3 4 9 6 10 7 6 6 6 4 9 9 8 9
84
# Problem Link:     https://codeforces.com/problemset/problem/651/B
# Problem Status:
# ------------------------------- SEPARATOR -------------------------------
# IDEA:
# ------------------------------- SEPARATOR -------------------------------
A = []
Repeated = []
Answer = 0
Line = input()
N = int(Line)
Line = input().split().copy()
for x in Line:
    A.append(int(x))
A.sort()
# ------------------------------- SEPARATOR -------------------------------
for i in range(1, len(A)):
    if A[i] == A[i-1]:
        Repeated.append(A[i])
# ------------------------------- SEPARATOR -------------------------------
Repeated.sort()
c = 0
# ------------------------------- SEPARATOR -------------------------------
for i in range(len(Repeated)):
    A.remove(Repeated[c])
    A.append(Repeated[c])
    Repeated.remove(Repeated[c])
    if c == 0:
        c = -1
    else:
        c = 0
# ------------------------------- SEPARATOR -------------------------------
for i in range(1, len(A)):
    if A[i] > A[i-1]:
        Answer += 1
print(Answer)
# ------------------------------- SEPARATOR -------------------------------
