#include <bits/stdc++.h>
using namespace std;
static const int MAX_N = 100000;
int A[MAX_N];
int dp[MAX_N];
int n;
int lis() {
  int res = 0;
  for (int i = 0; i < n; ++i) {
    dp[i] = 1;
    for (int j = 0; j < i; ++j) {
      if (A[j] < A[i]) dp[i] = max(dp[i], dp[j] + 1);
    }
    res = max(res, dp[i]);
  }
  return res;
}
int main(int argc, char** argv) {
  int i;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) scanf("%d", &A[i]);
  printf("%d\n", lis());
  return 0;
}
