#include <bits/stdc++.h>
using namespace std;
int n, a[100000], dp[100000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) dp[i] = 1;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (a[i] > a[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
  }
  int res = 1;
  for (int i = 0; i < n; ++i) res = max(res, dp[i]);
  cout << res << endl;
  return 0;
}
