#include <bits/stdc++.h>
int findNumberOfLIS(int nums[], int n) {
  int l = n;
  int lis[l];
  for (int i = 0; i < l; i++) {
    lis[i] = 1;
    for (int j = 0; j < i; j++) {
      if (nums[i] > nums[j] && lis[j] >= lis[i]) {
        lis[i] = lis[j] + 1;
      }
    }
  }
  int res = 0;
  for (int i = 0; i < l; i++) {
    if (lis[i] > res) res = lis[i];
  }
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  int nums[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &nums[i]);
  }
  printf("%d\n", findNumberOfLIS(nums, n));
  return 0;
}
