import sys

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

c = 0

for i in range(0, len(a)):
	s = 0
	for j in a[i:]:
		s = s + j
		if s == 0:
			c = c + 1
		else:
			break
print(c)
