#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, longest = 0;
  int num[100000];
  int dp[100000];
  cin >> n;
  fill(dp, dp + n, 1);
  for (int i = 0; i < n; ++i) {
    cin >> num[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (num[i] > num[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    longest = max(longest, dp[i]);
  }
  cout << longest << endl;
}
