#include <bits/stdc++.h>
using namespace std;
int n;
long long a[10005];
int dp[10005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  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[j] + 1, dp[i]);
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}
