n=gets.chomp.to_i
list=gets.split.map(&:to_i)
k = 0
l = 0
sum  = 0
count = 0
while k < n do
  while l < n  do
    sum += list[l]
      if sum==0
        count+=1
      end
    l += 1
  end
  k += 1
  l = k
  sum = 0
end
puts count
