#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n;
  cin >> n;
  long long a[100000];
  for (int i = 0; i < ((int)(n)); i++) cin >> a[i];
  long long DP[100001];
  for (int i = 0; i < ((int)(n)); i++) DP[i] = 1;
  long long ans = 0;
  for (int i = 0; i < ((int)(n)); i++) {
    for (int j = 0; j < ((int)(i)); j++) {
      if (a[i] > a[j] && DP[i] < DP[j] + 1) DP[i] = DP[j] + 1;
      if (DP[i] > ans) ans = DP[i];
    }
  }
  cout << ans << endl;
  return 0;
}
