N = int(input())
a = [int(i) for i in input().split()] 
def p(n,m):
    i = n
    b = 0
    while i < m+1:
        b = b+a[i]
        i = i + 1
    return b
num = 0
for j in range(N):
    k = j+1
    while k < N:
        if p(j,k) == 0:
            num = num + 1
        k = k+1
print(num)
        