#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> digits(n);
  vector<int> longestSeqEndingOn(n, 1);
  longestSeqEndingOn[0] = 1;
  for (int i = 0; i < n; i++) cin >> digits[i];
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++)
      if (longestSeqEndingOn[i] <= longestSeqEndingOn[j] &&
          digits[i] > digits[j])
        longestSeqEndingOn[i] = longestSeqEndingOn[j] + 1;
  int m = 0;
  for (int i : longestSeqEndingOn) m = max(m, i);
  cout << m << endl;
}
