N=int(input())
list=list(map(int,input().split()))

res=0
count=0
for i in range(N-1):
    res=list[i]
    if res == 0:
        count+=1
    for j in range(i+1,N,1):
        res+=list[j]
        if res==0:
            count+=1
print(count)
