#include <bits/stdc++.h>
using namespace std;
long *a;
map<int, pair<int, long> > memo;
pair<int, long> calc(int x) {
  map<int, pair<int, long> >::iterator it = memo.find(x);
  if (it != memo.end()) return (*it).second;
  int length = 1;
  pair<int, long> longest = make_pair(1, a[x]);
  for (int i = x - 1; i >= 0; i--) {
    pair<int, long> cur = calc(i);
    if (a[x] > cur.second && cur.first + 1 > length) {
      longest = make_pair(cur.first + 1, a[x]);
      length = cur.first + 1;
    } else if (cur.first > length) {
      longest = cur;
      length = cur.first;
    }
  }
  memo.insert(make_pair(x, longest));
  return longest;
}
int main() {
  int n;
  scanf("%d", &n);
  a = new long[n];
  for (int i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  printf("%d", calc(n - 1).first);
  return 0;
}
