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

#Sum = np.zeros(N)
#
#for i in range(N):
#    Sum[i] = Sum[i-1] + A[i]

count = 0

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