retsu = int(input())
mohu= input()
mohuy=mohu.split(" ")
y=list(map(int,mohuy))

count=0

for i in range(retsu):
    sum=0
    
    for j in range(retsu-i): 
        sum += y[j+i]
        
        if sum == 0:
            count+=1
            
print(count)