#include <bits/stdc++.h>
int main() {
  int i, j, n;
  int max;
  int a[100000];
  int d[100000] = {0};
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  d[0] = 1;
  for (i = 0; i < n; i++) {
    max = 0;
    for (j = 0; j < i; j++) {
      if (a[j] < a[i] && d[j] > max) {
        max = d[j];
      }
    }
    d[i] = max + 1;
  }
  max = -1;
  for (i = 0; i < n; i++) {
    if (d[i] > max) max = d[i];
  }
  printf("%d\n", max);
  return 0;
}
