n = int(input())
a = list(map(int, input().split()))
result = 0

for i in range(n):
    sum_in_loop = a[i]
    for j in range(i+1, n):
        sum_in_loop += a[j]
        if sum_in_loop == 0:
            result += 1

print(result)
