#include <fstream>
using namespace std;
ifstream in("gogosi.in");
ofstream out("gogosi.out");
int main()
{
unsigned short int v[1000000]={0},x,ok ;int i,j,n,grupamaxima=1;
in>>n;
in>>x;//primul numar citit este cel maxim in prima grupa
v[grupamaxima]=x;
for( i=1; i<n; i++){
in>>x;
ok=0;
for(j=1;j<=grupamaxima&&!ok;j++)
if(v[j])
{if(x>=v[j]){v[j]=x;ok=1;}
}
if(!ok) {++grupamaxima;v[grupamaxima]=x;}
}
out<<grupamaxima;
return 0;
}