N = int(input())
A = list(map(int,input().split()))
answer = 0
for i in range(len(A)) :
    a = 0
    for j in range(i,len(A)) :
        a = a + A[j]
        if a == 0 :
            answer += 1
print(answer)

