#include <bits/stdc++.h>
using namespace std;
int N;
int dp[100001];
long long a[100001];
int main(void) {
  cin >> N;
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < i; ++j) {
      if (a[j] < a[i]) dp[i] = max(dp[j] + 1, dp[i]);
    }
  }
  cout << dp[N - 1] + 1 << endl;
  return 0;
}
