#include <bits/stdc++.h>
using namespace std;
long n, m = 0;
long a[100001], b[100001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (a[j] < a[i]) b[i] = max(b[j] + 1, b[i]);
    }
    m = max(m, b[i]);
  }
  cout << m << endl;
  return 0;
}
