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