N = int(input())
A = [int(i) for i in input().split(' ')]
cnt = 0
for n in range(N):  # define n-gram
  for x in range(N - n):
    print(A[x:x+n])
    if A[x:x+n] and sum(A[x:x+n]) == 0:
      print(A[x:x+n])
      cnt += 1
print(cnt)