#include <bits/stdc++.h>
using namespace std;
long long a[100001];
int dp[100001];
int main() {
  int n;
  cin >> n;
  a[0] = 0;
  dp[0] = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    int maximum = 1;
    for (int j = 1; j < i; j++)
      if (a[j] < a[i] && maximum < dp[j] + 1) maximum = dp[j] + 1;
    dp[i] = maximum;
  }
  cout << dp[n] << endl;
  return 0;
}
