N = int(input())
A = list(map(int, input().split()))
t = 0
for i in range(N):
    for j in range(N-i):
        X = 0
        for k in range(i+1):
            X += A[j+k]
        if X == 0:
            t += 1

print(t)