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