input = gets.to_i
nums = []

for i in 0..input-1 do
	nums.push(i)
end

arr = gets.split(' ').map(&:to_i)
count = 0
nums.combination(2){|a,b| 
	sum = 0
	for i in a..b do
		sum += arr[i]
	end
	if sum == 0 then
		count += 1
	end

}

puts count