#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
long long n;
long long a[110000];
long long dp[110000];
long long ans;
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    dp[i] = 1;
    for (long long j = 0; j < i; j++) {
      if (a[j] < a[i]) dp[i] = max(dp[i], dp[j] + 1);
    }
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}
