n=int(input()) l=list(map(int,input().split())) c=0 nl=[] for i in l: if i==1: nl.append(0) else: nl.append(1) ml=l d=0 K=[] for i in range(n): if l[i]==1: K.append(i) for j in K: for i in range(n-1): if l[j+i]==1 and j+i