n = int(input())
a = list(map(int, input().split()))

ans = 0

for i in range(n):
    sum = a[i]
    if sum == 0:
        ans += 1
    for j in range(i+1, n):
        sum += a[j]
        if sum == 0:
            ans += 1

print(ans)