n = int(input())
A = [int(i) for i in input().split()]

cnt = 0
for i in range(n):
    dp = 0
    for j in range(i, n):
        dp += A[j]
        if dp == 0:
            cnt += 1
            
print(cnt)