N=int(input()) A=list(map(int,input().split())) a=b=0 for i in range(N-1): if A[i]