N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N+1):
  for j in range(N+1):
    if j > i :
      ai = a[i:j]
      go = sum(ai)
      if go == 0:
        count += 1
print(count) 