#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3;
int v[MAXN + 2], nxt[MAXN + 2];
int main() {
  int n, elim = 0, unuap = 0, num;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    v[i] += v[i - 1];
  }
  elim = v[n];
  for (int i = 1; i <= n; ++i)
    elim = min(elim, v[i - 1] + (n - i) - (v[n] - v[i]));
  cout << n - elim;
  return 0;
}
