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