n=int(input())
a=input().split()
a=[int(i) for i in a]
count=0

for i in range(0,n):
  for j in range(i,n):
    if a[i:i+j]!=[]:
      if sum(a[i:i+j])==0:
        print(a[i:i+j])
        count+=1
if a[-1]+a[-2]==0:
  count-=1
print(count)