#include <bits/stdc++.h>
using namespace std;
const double pi = 4 * atan(1.0);
int mod = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int> arr(N);
  for (auto& val : arr) cin >> val;
  vector<int> dp(N);
  dp[0] = 1;
  for (int i = 1; i < N; ++i) {
    int MAX = 0;
    for (int j = 0; j < i; ++j) {
      if (arr[i] > arr[j]) {
        MAX = max(MAX, dp[j]);
      }
      dp[i] = MAX + 1;
    }
  }
  int ans = 0;
  for (const auto& val : dp) {
    ans = max(ans, val);
  }
  cout << ans << endl;
  return 0;
}
