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

amount = 0
for i in range(N):
    number = A[i]
    for j in range(i+1,N):
        number += A[j]
        if number == 0:
            amount += 1

print(amount)