n = int(input())
aa = list(map(int, input().split()))

count=0
for i in range(n+1):
    for j in range(i+1,n+1):
        # print(aa[i:j], sum(aa[i:j]))
        summary = sum(aa[i:j])
        if summary==0:
            count+=1
print(count)