import numpy as np

N = input()
A = input()

aline = A.split(" ")
aline = [int(x) for x in aline]
num = 0

for i in range(int(N)):
  for j in range(1, int(N)-i+1):
    line = aline[i:i+j]
    res = np.sum(line)
    if res == 0:
      num += 1

print("{}".format(num))