#include <bits/stdc++.h>
using namespace std;
long long int m, n, c, d, j, k, l, r, x, t, y, u, z, i, e, f, g, h, b;
int main() {
  cin >> n;
  long long int a[n + 1];
  d = n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (!a[i]) c++;
    if (a[i]) k = max(k + 1, c + 1);
  }
  cout << max(k, c);
}
