length = int(input())
a = [int(i) for i in input().split()]
count = 0
for j in range(length):
    lenlen = length - j
    for k in range(lenlen):
        answer = 0
        for l in range(k+1):
            answer = answer + a[j+l]
        if answer == 0:
            count = count + 1
print(count)