#include <bits/stdc++.h>
using namespace std;
const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
inline int in() {
  int x;
  std::cin >> x;
  return x;
}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  for (int i = 0; i < v.size(); i++) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
int gcd(int a, int b) {
  int c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
int dp[100005];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n = in();
  int ans = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) a[i] = in();
  for (int i = 0; i < n; i++) {
    dp[i] = 1;
    for (int j = 0; j < i; j++) {
      if (a[i] > a[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    ans = max(ans, dp[i]);
  }
  print(ans);
  return (0);
}
