#include <bits/stdc++.h>
using namespace std;
long long t;
long long x[1000100];
long long temp;
long long ans;
long long mem[10000100];
long long dp[10000000];
signed main() {
  cin >> t;
  for (long long i = 0; i <= t; i++) mem[i] = -1;
  for (long long i = 0; i < t; i++) cin >> x[i];
  long long res = 0;
  for (long long i = 0; i < t; i++) {
    dp[i] = 1;
    for (long long j = i + 1; j < t; j++) {
      if (x[i] < x[j]) dp[i] = max(dp[i], dp[j] + 1);
    }
    res = max(res, dp[i]);
  }
  cout << res << endl;
  return 0;
}
