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

count = 0
for n in range(N):
    tmp = 0
    for k in range(n, N):
        tmp += A[k]
        if tmp == 0:
            count += 1

print(count)