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