N = int(input())
A = input().split()

count = 0
i = 0
while(i < N):
    j = i
    num = 0
    while(j < N):
        num = num + int(A[j])
        if(num == 0):
            count = count + 1
        j = j + 1
    i = i + 1
print(count)
