n = int(input())
list_a = list((map(int, input().split())))
memo = 0
ans = 0
i = 0
j = 0
while i < n:
    while j < n-i:
        memo += list_a[i+j]
        #print(memo)
        if memo == 0:
            ans += 1
        j += 1
    memo = 0
    i += 1
    j = 0
print(ans)
