#include <bits/stdc++.h>
using namespace std;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;
template <typename T>
void printA(vector<T> &printArray, char between = ' ') {
  int paSize = printArray.size();
  for (int i = 0; i < paSize; i++) {
    cerr << printArray[i] << between;
  }
  if (between != '\n') {
    cerr << endl;
  }
}
int n;
long long a[111111];
int dp[111111];
int main() {
  cin >> n;
  for (int(i) = (0); (i) < (n); ++(i)) {
    scanf("%lld", &a[i]);
  }
  int ans = 0;
  for (int(i) = (0); (i) < (n); ++(i)) {
    int Max = 0;
    for (int(j) = (0); (j) < (i); ++(j)) {
      if (a[j] < a[i]) {
        Max = max(Max, dp[j]);
      }
    }
    dp[i] = Max + 1;
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}
