N=int(input())
A=list(map(int, input().split()))
count=0
for i in range (len(A)):
    for j in range(i+1,len(A)):
        print (A[i:j+1])
        print (sum(A[i:j+1]))
        if sum(A[i:j+1])==0:
            count+=1
print (count)