//最长上升子序列
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
int b[1010];
int maxLen[1010];
int main()
{
int N;
cin >> N;
for(int i=1; i<=N ; i++)
cin >> b[i];
maxLen[1]=1;
for(int i=2; i<=N; i++)
{//每次求以第i个数为终点的最长上升子序列的长度
int tmp=0; //记录满足条件的,第i个数左边的上升子序列的最大长度;
for(int j=1; j<i ; j++) //查看以第j个数为终点的最长上升子序列;
{
if(b[i] > b[j])
if(tmp < maxLen[j])
tmp=maxLen[j];
}
maxLen[i] =tmp+1;
}
int maxL=1;
for(int i=1; i<=N ;i++)
if(maxL < maxLen[i])
maxL = maxLen[i];
cout << maxL;
return 0;
}