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

s = 0

result = 0
for s in range(n):
    previous = 0
    for e in range(s, n):
        previous += a[e]
        if previous == 0:
            result += 1
print(result)

