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