#include <bits/stdc++.h>
const long long INF = 0x3f3f3f3f;
const double E = exp(1);
const double PI = acos(-1);
using namespace std;
long long kc(long long a, long long b) {
  long long c = 1;
  while (b) {
    if (b & 1) c *= a;
    a *= a;
    b >>= 1;
  }
  return c;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int s[200003];
bool cmp(int a, int b) { return a > b; }
int main() {
  int n, a[30], b[30], sum;
  sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    if (sum) {
      if (a[i] >= b[sum - 1]) {
        b[sum++] = a[i];
      } else {
        if (a[i] >= a[1]) b[lower_bound(b, b + sum, a[i]) - b] = a[i];
      }
    } else {
      if (a[i] >= a[1]) b[sum++] = a[i];
    }
  }
  cout << sum + 1 << endl;
}
