n = int(input())
num = input().split()
num=[int(x) for x in num]
count = 0

for i in range(0,n):
    sum=0
    for j in range(i,n):
        sum+=num[j]
        if(sum==0):
            count+=1

print(count)