import numpy as np
n = int(input())
a_ls = list(map(int, input().split()))
csum = list(np.cumsum(a_ls))
ans = 0

for start in range(1,n):
    for end in range(start, n):
        if csum[end] - csum[start-1] == 0:
            ans += 1
for i in range(n):
    if csum[i] == 0:
        ans += 1
print(ans)

