N = int(input())
A = [int(x) for x in input().split(' ')]

cnt = 0
for i in range(N):
    asum = A[i]
    j = i + 1
    while j < N:
        asum += A[j]
        if asum == 0:
            cnt += 1
        j += 1

print(cnt)