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