n = int(input())
A = [int(i) for i in input().split()]
count = 0
for j in range(n):
    for k in range(1,n-j+1,1):
        print(A[j:j+k])
        if not sum(A[j:j+k]):
            count += 1
print(count)