

function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  input.shift();
  var A = input.map(i => parseInt(i));
  A.splice(N,A.length);
  var c = [A[0]];
  for(var i=1;i<N;i++){
    for(var j=0;j<c.length;j++){
      var flag=0;
      if(c[j]<A[i]){
        c[j]=A[i];
        flag=1;
        break;
      }
    }
    if(flag==0){
      c.push(A[i]);
    }
    c.sort(function(a,b){return b-a});
  }
  var ans = c.length;

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));