#include <bits/stdc++.h>
using namespace std;
int dp[100000 + 1];
int n, a[100000];
int main() {
  scanf("%d", &n);
  for (int(i) = (0); ((i)) < ((n)); ++(i)) scanf("%d", a + i);
  for (int(i) = (0); ((i)) < ((n)); ++(i)) {
    dp[i] = 1;
    for (int(j) = (0); ((j)) < ((i)); ++(j)) {
      if (a[i] > a[j])
        dp[i] = max(dp[j] + 1, dp[i]);
      else
        dp[i] = max(dp[j], dp[i]);
    }
  }
  printf("%d\n", dp[n - 1]);
  return 0;
}
