#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll INF = (1LL << 32);
const ll MOD = (ll)1e9 + 7;
const double EPS = 1e-9;
ll dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
ll dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
static const ll MAX = 100000;
ll n, A[MAX + 1], L[MAX + 1];
ll lis() {
  ll length = 1;
  L[0] = A[0];
  for (ll i = (1); i < (n); i++) {
    if (L[length - 1] < A[i])
      L[length++] = A[i];
    else
      L[length - 1] = A[i];
  }
  return length;
}
signed main() {
  ios::sync_with_stdio(true);
  cin >> n;
  for (ll i = 0; i < n; i++) cin >> A[i];
  cout << lis() << endl;
  return 0;
}
