import sys
import os

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

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