n = int(input())
a = list(map(int, input().split()))
count = 0
sum = 0

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