#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int solve(vector<int> a) {
  int n = a.size();
  vector<int> dp(n, 1);
  int ret = 1;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (a[i] > a[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    ret = max(ret, dp[i]);
  }
  return ret;
}
int main() {
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    fscanf(stdin, "%d", &a[i]);
  }
  int ans = solve(a);
  fprintf(stdout, "%d", ans);
  fprintf(stdout, "\n");
  return 0;
}
