#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
int main() {
  int lis[MAX], a[MAX];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) lis[i] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++)
      if (a[j] < a[i]) lis[i] = lis[j] + 1;
  int *maxL = max_element(lis, lis + n);
  cout << *maxL << endl;
}
