#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int a[100000], f[100000];
int n, ans = -0x3f3f3f3f;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[i] = 1;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i - 1; j++)
      if (a[i] > a[j]) f[i] = max(f[i], f[j] + 1);
  for (int i = 1; i <= n; i++) ans = max(ans, f[i]);
  cout << ans << endl;
  return 0;
}
