n = int(input())
m = list(map(int,input().split()))

c=0
for i in range(1,n):
    for l in range(0,n-i+1):
        print(i,l,m[l:l+i])
        if sum(m[l:l+i])==0:
            c +=1
        else:
            c=c
print(c)