#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b) {
    long long tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int N;
int a[100000];
int dp[100000];
int solve() {
  int res = 0;
  for (int i = 0; i < N; i++) {
    dp[i] = 1;
    for (int j = 0; j < i; j++) {
      if (a[i] > a[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    res = max(res, dp[i]);
  }
  return res;
}
int main() {
  cin >> N;
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
  }
  memset(dp, 0, sizeof(dp));
  cout << solve() << endl;
  ;
}
