n = gets.to_i
arr = []
n.times do
  arr << gets.chomp.to_i
end
answer = []
arr.each do |i|
  if i == 0
    answer << [i]
    next
  end
  merged = false
  if answer[0][-1] < i
    answer.each do |_arr|
      if _arr[-1] < i
        _arr << i
        merged = true
        break
      end
    end
  end
  answer << [i] unless merged
end
p answer.length
