#include<bits/stdc++.h>
using namespace std;
int n,a[100],b[100],ans;
//n:8
//a 389 207 175 300 299 170 158 165
//----------------------------------------
//ans:2
// 1 2 3 4 5 6
//b 158 300
//
// 循环A
// 当走到207的时候,
// 设为没找到
// 就需要问1到ans的人
// 如果你比207大,就由你来打
// 打完就跳出了
// 找到
// 如果最后还是没找到,那么ans+1
// 再让ans这个来打导弹
//=
//
int main(){
cin>>n;
for(int i=1;i<=n;i++) {
cin>>a[i];
bool f=false;
for(int j=1;j<=ans;j++){
if(b[j]>=a[i]){
f=true;
b[j]=a[i];
break;
}
}
if(!f){
ans++;
b[ans]=a[i];
}
// for(int j=1;j<=ans;j++) cout<<b[j]<<" ";
// cout<<endl;
// cout<<ans<<endl;
}
cout<<ans;
return 0;
}
/**************************************************************
Problem: 1229
User: hulaoshi
Language: C++
Result: Accepted
Time:20 ms
Memory:2072 kb
****************************************************************/