n = int(input())
a = [int(i) for i in input().split()]
count = 0

for i in range(n):
	for j in range(n - i):
		sum = 0
		for k in range(i + 1):
			sum += a[j + k]
		if sum == 0:
			count += 1
			#print(i, j)

print(count)
