#include <bits/stdc++.h>
int n, l[100000], i, j, dp[100000];
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &l[i]), dp[i] = 1;
  for (i = 0; i < n; i++)
    for (j = i; j < n; j++)
      if (l[i] < l[j]) dp[j] = (dp[j]) > (dp[i] + 1) ? dp[j] : dp[i] + 1;
  for (i = j = 0; i < n; i++) j = (j) > (dp[i]) ? j : dp[i];
  printf("%d\n", j);
  return 0;
}
