void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto a=new int[](n);
  foreach(i; 0..n) rd(a[i]);

  sort(a);
  auto rec=new int[](n);
  foreach(i; 0..n){
    int mx=0;
    foreach(j; 0..i)if(a[j]<a[i]){
      mx=max(mx, rec[j]);
    }
    rec[i]=mx+1;
  }

  writeln(reduce!(max)(rec));
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}