N = gets.to_i

res = []

N.times do
  n = gets.to_i

  ok = false
  res.each_with_index do |r, i|
    next if r >= n

    res[i] = n
    ok = true
    break
  end

  unless ok
    res << n
  end
end

puts res.size
