# coding :utf-8

N = int(input())

A = list(map(int, input().split()))

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

print(ans)