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