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

ans = 0

for i in range(N):
    for j in range(i,N+1):
        if i != j:
            if sum(A[i:j]) == 0:
                ans += 1

print(ans)
