#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
int ans[100001],n,a[100001],MAX=0;
inline const void read(int &a)
{
a=0;
int k=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-')
k=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
a*=k;
}
int main()
{
//freopen("sort.in.txt","r",stdin);
//freopen("sort.out.txt","w",stdout);
int ai;
read(n);
for(int i=1;i<=n;i++)
{
read(a[i]);
int MAX1=0;
for(int j=i-1;j>=1;j--)
{
if(MAX1<ans[j]&&a[i]>=a[j])
MAX1=ans[j];
}
ans[i]=MAX1+1;
if(ans[i]>MAX)
MAX=ans[i];
}
cout<<MAX<<endl;
return 0;
}