#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> seq;
  int a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    seq.push_back(a);
  }
  int ans = 1;
  int dp[100000];
  dp[0] = 1;
  for (int i = 1; i < n; ++i) {
    dp[i] = 1;
    for (int j = 0; j < i; ++j) {
      if (seq[j] < seq[i]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}
