n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    count = a[i]
    for j in range(i+1, n):
        count += a[j]
        if count == 0:
            ans += 1
print(ans)