#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN = 1010;
int a[MAXN]; //保存数组
int maxLen[MAXN]; //以该下标为终点的最长上升子序列
int main()
{
int N;
cin >> N;
for(int i = 1;i <= N; i++) //下标为0的被忽略掉
{
cin >> a[i];
maxLen[i] = 1;
}
//以某个为终点的上升子序列
for(int i = 2;i <= N;i++)
{
for( int j = 1;j < i;j++)
{
if(a[i] > a[j])
maxLen[i] = max(maxLen[i],maxLen[j]+1); //
}
}
cout << *max_element(maxLen+1,maxLen + N + 1);
return 0;

}