#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> sequence(n);
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sequence[i] = a;
  }
  vector<int> LIS(n, 1);
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (sequence[i] > sequence[j]) {
        if (1 + LIS[j] > LIS[i]) {
          LIS[i] = 1 + LIS[j];
        }
      }
    }
  }
  cout << LIS[n - 1] << endl;
}
