#include <bits/stdc++.h>
using namespace std;
int A[100000] = {0};
int LIS[100000] = {0};
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  LIS[0] = 1;
  for (int i = 1; i < N; ++i) {
    int maxl = 0;
    for (int j = 0; j <= i; ++j) {
      if (A[i] > A[j] && LIS[j] > maxl) {
        maxl = LIS[j];
      }
    }
    LIS[i] = maxl + 1;
  }
  cout << LIS[N - 1] << endl;
  return 0;
}
