n = int(input())
arr = [int(e) for e in input().split()]
res = 0
for i in range(n):
    sum = 0
    for j in range(i, n):
        sum = sum + arr[j]
        if sum == 0:
            res = res + 1
print(res)
