#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N], cnt[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    cnt[i] = 1;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < i; j++) {
      if (a[j] < a[i]) cnt[i] = max(cnt[i], cnt[j] + 1);
    }
  }
  cout << cnt[N - 1] << '\n';
}
