N = input() Alist = [] Alist = map(int, raw_input().split()) Alist.sort() cnt = 0 if N != 1: for i in range(1, N-1): if Alist[i-1] != Alist[i] and Alist[i] != Alist[i+1]: cnt = cnt + 1 if Alist[0] != Alist[1]: cnt += 1 if Alist[N-2] != Alist[N-1]: cnt += 1 print cnt else: print 1