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