n = int(input())
l = list(map(int, input().split()))

o = len(l)
count = 0

for i in range(n):
    for j in range(o):
        if i >= j+1:
            continue
        if sum(l[i:j+1]) == 0:
            count += 1
print(count)
