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