#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  long long* Data = (long long*)malloc(n * sizeof(long long));
  for (int i = 0; i < n; ++i) scanf("%lld", &Data[i]);
  long long* DP = (long long*)malloc(n * sizeof(long long));
  for (int i = 0; i < n; ++i) {
    DP[i] = 1;
  }
  long long maxEl = 1;
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j < i; j++) {
      if (Data[i] > Data[j]) {
        if (DP[i] < DP[j] + 1) {
          DP[i] = DP[j] + 1;
          if (DP[i] > maxEl) maxEl = DP[i];
        }
      }
    }
  }
  printf("%lld\n", maxEl);
  return 0;
}
