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

sumA = [0]*(N+1)

for i in range(N):
    sumA[i+1] = sumA[i]+A[i]
ans = 0
for i in range(1, N+1):
    for j in range(0, i):
        if sumA[i] - sumA[j] == 0:
            ans += 1

print(ans)
