N = int(input())
a = [int(i) for i in input().split()] 
num = 0
j = 0
while j < N:
    c = 0
    k = j 
    while k < N:
        c = c + a[k]
        if c == 0:
            num = num+1
        k = k+1
    j = j+1
print(num)