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

ans = 0

for i in range(N):
    total = 0
    for item in inputs[i:]:
        total += item
        if total == 0:
            ans += 1

print(ans)
