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