#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp;
  vector<int> a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    a.push_back(temp);
  }
  vector<int> b(n);
  fill(b.begin(), b.end(), 1);
  for (int i = n - 1; i > -1; i--) {
    for (int j = n - 1; j > i; j--) {
      if (a[i] < a[j]) {
        b[i] = max(b[j] + 1, b[i]);
      }
    }
  }
  int res = 0;
  for (int i = 0; i < n; i++) {
    res = max(res, b[i]);
  }
  cout << res << endl;
  return 0;
}
