#include <bits/stdc++.h>
using namespace std;
static const int MAX = 100000;
int solve(int data[], int n) {
  int lengths[MAX];
  lengths[0] = 1;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    int premax = 0;
    for (int j = 0; j < i; j++) {
      if (data[j] < data[i]) {
        premax = max(lengths[j], premax);
      }
    }
    lengths[i] = premax + 1;
    ans = max(ans, lengths[i]);
  }
  return ans;
}
int main() {
  int data[MAX];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> data[i];
  cout << solve(data, n) << endl;
}
