#include <bits/stdc++.h>
using namespace std;
template <typename T>
vector<vector<T>> make_2d_vector(size_t rows, size_t cols, T init) {
  return vector<vector<T>>(rows, vector<T>(cols, init));
}
const int inf = 100000000;
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<int> dp(N + 1);
  dp[0] = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j < i; j++) {
      dp[i] = 1;
      if (a[j - 1] < a[i - 1]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
  }
  int res = 0;
  for (int i = 0; i <= N; i++) {
    res = max(res, dp[i]);
  }
  cout << res << "\n";
  return 0;
}
