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