n=int(input()) a=map(int,input().split()) z=0 for i in range(n) : if a[i] == 0 : z+=1 else: a=[0 if aj==a[i] else aj for aj in a] print(n-z)