#include <bits/stdc++.h>
const int Max = 100000;
using namespace std;
int a[1080];
int dp[1080];
int main() {
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) dp[i] = 1;
    int ans = 1;
    for (int i = 1; i < n; i++) {
      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;
}
