#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
const int N = 100005;
int a[N];
int dp[N];
int n;
int mmax;
void solve() {
memset(dp, 0, sizeof(dp));
mmax = 0;
if(n > 0) mmax = 1;
for(int i = 0; i < n; ++i) {
dp[i] = 1;
}
for(int i = 1; i < n; i++) {
for(int j = i-1; j >= 0; j--) {
if(a[i] > a[j]) {
dp[i] = max(dp[i], dp[j]+1);
}
}
if(dp[i] > mmax) mmax = dp[i];
}
cout << mmax << endl;
}
int main() {
while(cin >> n) {
for(int i = 0; i < n; i++) {
cin >> a[i];
}
solve();
}
return 0;
}