import itertools
N = int(input())
A = list(map(int,input().split()))
Acc = list(itertools.accumulate(A))
ans = 0
for i, j in itertools.combinations(Acc, 2):
    if i == j:
        ans += 1
for i in Acc:
    if i == 0:
        ans += 1
print(ans)