import sys

n = int(input())
m = list(map(int,input().split()))
c=0
if n==1  and m[0] ==0:
  print(1)
  sys.exit()
else:
  c=0
  
for i in range(1,n):
    for l in range(0,n-i+1):
        if sum(m[l:l+i])==0:
            c +=1
        else:
            c=c
print(c)