#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
static const string abet(
    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long int MOD = 1000000007;
static const double PI = 3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);
static const int dy4[] = {0, 0, 1, -1};
static const int dx4[] = {1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int longest_increasing_subsequence(int N, vector<int> a) {
  int res = 0;
  int dp[N + 1];
  for (int i = (0); i < (N); ++i) {
    dp[i] = 1;
    for (int j = (0); j < (i); ++j)
      if (a[j] < a[i]) dp[i] = max(dp[i], dp[j] + 1);
    res = max(res, dp[i]);
  }
  return res;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = (0); i < (N); ++i) cin >> p[i];
  ;
  cout << longest_increasing_subsequence(N, p) << endl;
}
