n=int(input()) a=list(map(int,input().split())) flag=0 for i in range(n-1): if a[i+1]