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