#include <bits/stdc++.h>
using namespace std;
int rec[100000];
int len[100000];
int main() {
  int con, ptr = 0, sum = 0;
  scanf("%d", &con);
  while (con--) {
    scanf("%d", &rec[ptr]);
    len[ptr] = 1;
    ptr++;
  }
  for (int i = 0; i < ptr; ++i) {
    for (int j = i + 1; j < ptr; ++j) {
      if (rec[i] < rec[j]) len[j] = max(len[j], len[i] + 1);
    }
  }
  for (int g = 0; g < ptr; ++g) {
    sum = max(len[g], sum);
  }
  printf("%d\n", sum);
  return 0;
}
