N = int(input())
A = list(map(int, input().split()))
count = 0

for i in range(N-1):
    for j in range(N-1):
        if N-i-1 == j:
            break
        else:
            if sum(A[i:N-j]) == 0:
                count += 1

print(count)