import itertools
x = input()
N = list(map(int, input().split()))
ans = 0
for i in range(len(N)):
    s = N[i]
    if N[i] == 0:
        ans += 1
    for j in range(i+1, len(N)):
        s += N[j]
        if s == 0:
            ans += 1

print(ans)