from operator import add
from functools import reduce

N = input()
A = input()

aline = A.split(" ")
aline = list(map(lambda x: int(x), aline))
num = 0

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

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