#include <bits/stdc++.h>
using namespace std;
class LISubsequence {
 public:
  int n;
  vector<int> a;
  vector<int> dp;
  LISubsequence() {}
  LISubsequence(int n) : n(n), a(n), dp(n, 1) {}
  int solve();
};
int LISubsequence::solve() {
  int cm = 1;
  for (auto i = 1; i < n; ++i) {
    for (auto j = 0; j < i; ++j) {
      if (a[i] > a[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    cm = max(cm, dp[i]);
  }
  cout << cm << endl;
  return 0;
}
int main() {
  int n;
  cin >> n;
  LISubsequence lis(n);
  for (auto i = 0; i < n; ++i) cin >> lis.a[i];
  lis.solve();
  return 0;
}
