n=int(input())
a = input()
d = []
x = []
r = []
g, g2, g3, g4, g5 = [],[],[],[],[]

for i in range(0, len(a)):
    if a[i] != ' ':
        d.append(int(a[i]))
d.reverse()
for i in range(0, len(d)):
    d.count(d[i])
    x.append([d[i], d.count(d[i])]) #

# for i in range(0, len(x)):
#     if x[i] not in r:
#         r.append(x[i])
g = x[0]
g2 = x[1]
g3 = x[2]
g4 = x[3]
g5 = x[4]

if g[1] == g[1]:
    g[1] = g[1]-1

print(g[1])
