#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
long long n, a[N], ans = 1;
long long dp[N] = {0};
long long mi;
int main() {
  mi = 1e9 + 1;
  cin >> n;
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  for (long long i = (0); i < (n); ++i) {
    dp[i] = 1;
    if (mi >= a[i]) {
      mi = a[i];
      continue;
    }
    for (long long j = (0); j < (i); ++j) {
      if (a[j] < a[i]) dp[i] = max(dp[i], dp[j] + 1);
    }
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}
