N=int(raw_input()) A=map(int,raw_input().split()) A.sort() ans=0 for i,a in enumerate(A): if not ((i>0 and A[i-1]==a) or (i+1