n = int(input())
list1 = list(map(int, input().split()))
index1 =0
count=0
while index1<n:
    index2 =0
    while index2<n-index1:
        sum=0
        index3=index1
        while index3<=index1+index2:
            sum+=list1[index3]
            index3+=1
        if sum==0:
            count+=1
        index2+=1
    index1+=1

print(count)
