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