N = gets.to_i
arr = N.times.map { gets.to_i }

res = [[]]

arr.each do |n|
  ok = false
  res.each do |r|
    if r[-1].nil? || r[-1] < n
      r << n
      ok = true
      break
    end
  end

  unless ok
    res << [n]
  end
end

puts res.size
