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

cnt = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        if sum(A[i : j]) == 0:
            cnt += 1
            print(A[i : j])

print(cnt)