#include <bits/stdc++.h>
using namespace std;
int coin_changing(vector<int> coin, const int sum) {
  static const int INF = 1000000000;
  sort(coin.begin(), coin.end());
  vector<int> dp(sum + 1, INF);
  dp[0] = 0;
  for (const auto& d : coin)
    for (int s = d; s <= sum; ++s) dp[sum] = min(dp[s], dp[sum - d] + 1);
  return dp[sum];
}
struct Goods {
  int value, weight;
};
int knapsack(const vector<Goods>& goods, const int capacity) {
  vector<int> dp(capacity + 1, 0);
  for (const auto& g : goods)
    for (int w = g.weight; w <= capacity; ++w)
      dp[w] = max(dp[w], dp[w - g.weight] + g.value);
  return *max_element(dp.begin(), dp.end());
}
int longest_increasing_subsequence(const vector<int>& sequence) {
  vector<int> dp(sequence.size(), 1);
  for (int i = 1; i < dp.size(); ++i)
    for (int j = i - 1; j >= 0; --j)
      if (sequence[j] < sequence[i]) dp[i] = max(dp[i], dp[j] + 1);
  return *max_element(dp.begin(), dp.end());
}
int main() {
  int n;
  while (cin >> n) {
    vector<int> array(n);
    for (auto& a : array) cin >> a;
    cout << longest_increasing_subsequence(array) << endl;
  }
}
