#include <bits/stdc++.h>
using namespace std;
int main() {
  int table[100000];
  int num[100000];
  int n;
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> num[i];
  }
  for (int i = 0; i < n; i++) {
    table[i] = 1;
    for (int j = 0; j < i; j++) {
      if (num[i] > num[j]) table[i] = max(table[i], table[j] + 1);
    }
    ans = max(ans, table[i]);
  }
  cout << ans << endl;
  return 0;
}
