from itertools import accumulate
N = int(input())
A = list(map(int,input().split()))
R = [0]+list(accumulate(A))
ans = 0
for i in range(N):
    for j in range(i+1,N+1):
        if R[j]-R[i] == 0:
            ans += 1
print(ans)