N = gets.to_i
A = (1..N).map { |_| gets.to_i }
  
colors = [ [0, A[0]] ]
now = [0, A[0]]


(1..N-1).each do |i|
  c_idx = colors.index { |c| c[1] < A[i] }

  if c_idx
    colors[c_idx] = [i, A[i]]
  else
    colors << [i, A[i]]
  end

  now = [i, A[i]]
end

puts colors.size