length = int(input())
hoge = [int(x) for x in input().strip().split()]

count = 0
total_sum = 0

for x in range(len(hoge)):
    total_sum = 0
    for y in hoge[x:]:
        total_sum += y
        if total_sum == 0:
            count += 1
print (count)        
