#include <bits/stdc++.h>
using namespace std;
int main() {
  int nbr;
  cin >> nbr;
  vector<int> sequence(nbr);
  vector<int> subsequence(nbr);
  for (int i = 0; i < nbr; i++) {
    int val;
    cin >> val;
    sequence[i] = val;
    subsequence[i] = 1;
  }
  for (int i = 1; i < nbr; i++) {
    for (int j = 0; j < i; j++) {
      if (sequence[i] > sequence[j] && subsequence[i] < subsequence[j] + 1) {
        subsequence[i] = subsequence[j] + 1;
      }
    }
  }
  int max = 0;
  for (int i = 0; i < nbr; i++) {
    if (max < subsequence[i]) {
      max = subsequence[i];
    }
  }
  cout << max << endl;
}
