#include <bits/stdc++.h>
using namespace std;
int N, A[100005], L[100005];
int main() {
  L[0] = 0;
  cin >> N;
  int i, j;
  for (i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (i = 1; i <= N; i++) {
    int k = 0;
    for (j = 0; j < i; j++) {
      if (A[i] >= A[j] && L[j] > L[k]) k = j;
    }
    L[i] = L[k] + 1;
  }
  cout << L[N] << endl;
  return 0;
}
