N = int(input())

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

count = 0
for i in range(N):
    total = 0
    for j in range(i,N):
        total = total + numbers[j]
        if total == 0:
            count += 1

print(count)