n=int(input())
cnt=0
list= [int(i) for i in input().split()]
for i in range(n):
    for j in range(i+1,n+1):
        if sum(list[i:j]) == 0:
            cnt+=1

        #print(list[i:j])
        #print(i,j)

print(cnt)