N=int(input())
A=list(map(int,input().split()))
count=0
for i in range(N):
    p=A[i]
    if p==0:
        count+=1
    for j in range(i+1,N):
        p+=A[j]
        if p==0:
            count+=1
print(count)