#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 1000000000;
int n, v[N], fr[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = n - 1; i >= 0; --i) v[i] += v[i + 1];
  int mx = v[0];
  for (int i = 0, ct = 0; i < n; ++i) {
    ct += v[i] == v[i + 1];
    mx = max(mx, ct + v[i]);
  }
  cout << mx << endl;
}
