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