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