#include <bits/stdc++.h>
using namespace std;
const int inf = 100000000;
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<int> dp(N + 1, 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[i], dp[j] + 1);
      }
    }
  }
  int mx = 0;
  for (int i = 0; i <= N; i++) {
    mx = max(mx, dp[i]);
  }
  cout << mx << "\n";
  return 0;
}
