N = int(input())
A = list(map(int, input().split()))

res = 0
for i in range(len(A)):
    temp = 0
    for j in range(i, len(A)):
        temp += A[j]
        if temp == 0:
            res += 1
print(res)