N = int(input())
A = list(map(int, input().split()))
n = 0
ans = 0
while n < N:
    sum = 0
    for a in A[n:]:
        sum = sum + a
        if sum == 0:
            ans = ans + 1
    n = n + 1
print(ans)