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