n = int(input())
a = [int(i) for i in input().split()]

#print(n)
#print(a)
answer = 0
for i in range(0,n):
    sum=0
    for j in range(i,n):
        sum = sum + a[j]
        if sum == 0:
            answer += 1

print(answer)

