#include<stdio.h>
int a[1009],b[1009];
int main()
{
int i,j,max,temp,n;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
scanf("%d",&a[i]);
b[0]=1;
for(i=1;i<n;i++)//最长上升子序列
{
temp=0;
for(j=0;j<i;j++)
if(a[i]>a[j])
{
if(temp<b[j])
temp=b[j];
}
b[i]=temp+1;
}
max=-1;
for(i=0;i<n;i++)
if(b[i]>max)
max=b[i];
printf("%d\n",max);
}
return 0;
}
int a[1009],b[1009];
int main()
{
int i,j,max,temp,n;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
scanf("%d",&a[i]);
b[0]=1;
for(i=1;i<n;i++)//最长上升子序列
{
temp=0;
for(j=0;j<i;j++)
if(a[i]>a[j])
{
if(temp<b[j])
temp=b[j];
}
b[i]=temp+1;
}
max=-1;
for(i=0;i<n;i++)
if(b[i]>max)
max=b[i];
printf("%d\n",max);
}
return 0;
}