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

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