lines = $stdin.read
array = lines.split("\n")

def get_lis(arr)
  lis_arr = Array.new(arr.length){1}
  length = 1

  #puts arr.to_s
  #puts lis_arr.to_s

  for i in 1...arr.length
    for j in 0...i
      lis_arr[i] = lis_arr[j] + 1 if arr[j] < arr[i] and lis_arr[i] < (lis_arr[j]+1)
    end
  end

  #puts lis_arr.to_s
  lis_arr.max
end

N = array[0].to_i
a = array[1..N]map(&:to_i).to_a

puts get_lis(a)