N=int(input())
A=list(map(int,input().split()))
ans=0
s=[0 for i in range(N+1)]

for i in range(N):
    s[i+1] = s[i] + A[i]

for i in range(N):
    for j in range(i+1):
        if s[i+1] - s[j] == 0:
            ans += 1

print(str(ans))
