#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline void minup(T1& m, T2 x) {
  if (m > x) m = static_cast<T2>(x);
}
template <class T1, class T2>
inline void maxup(T1& m, T2 x) {
  if (m < x) m = static_cast<T2>(x);
}
const int MAX_N = 100000;
int n;
int dp[MAX_N];
int a[MAX_N];
int res;
int main() {
  cin >> n;
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  for (int(i) = 0; (i) < (n); (i)++) {
    dp[i] = 1;
    for (int(j) = 0; (j) < (i); (j)++)
      if (a[j] < a[i]) maxup(dp[i], dp[j] + 1);
    maxup(res, dp[i]);
  }
  cout << res << endl;
  return 0;
}
