import sys

n = int(sys.stdin.readline())
a = [int(x) for x in sys.stdin.readline().split(" ")]

def sum(a, x,y):
	s = 0
	for i in a[x:y + 1]:
		s = s + i

	return s

c = 0

for i in range(0, len(a)):
	for j in range(i + 1, len(a)):
		if sum(a, i,j) == 0:
			c = c + 1
print(c)
