#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	ll n;
	cin>>n;
	ll a[100000];
	rep(i,n)cin>>a[i];
	ll DP[100001];//i?????????????????¨????????????????????§??????????¢??????¨???????????????
	DP[i]=1;
	ll ans=1;
	rep(i,n){
		rep(j,i){
			if(a[i]>a[j] && DP[i]<DP[j]+1)DP[i]=DP[j]+1;
		}
		if(DP[i]>ans)ans=DP[i];
	}
	cout<<ans<<endl;
	return 0;
}