#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  std::ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  scanf("%d", &n);
  int* Data = new int[n];
  for (int i = 0; i < n; ++i) scanf("%d", &Data[i]);
  unsigned long* DP = new unsigned long[n];
  for (int i = 0; i < n; ++i) {
    DP[i] = 1;
  }
  for (unsigned long i = 1; i < n; i++)
    for (unsigned long j = 0; j < i; j++)
      if (Data[i] > Data[j])
        if (DP[i] < DP[j] + 1) DP[i] = DP[j] + 1;
  cout << *max_element(DP, DP + n) << "\n";
  return 0;
}
