#include <bits/stdc++.h>
using namespace std;
int v[1003];
int main() {
  int n;
  cin >> n;
  int ok = 0;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  int bst = 0;
  for (int i = 1; i <= n + 1; i++) {
    int remove = 0;
    for (int j = 1; j <= n; j++) {
      if (v[j]) {
        if (j < i) {
          remove++;
        }
      } else {
        if (j > i) remove++;
      }
    }
    bst = max(n - remove, bst);
  }
  cout << bst;
  return 0;
}
