#include <bits/stdc++.h>
using namespace std;
int a[100005], mk[100005];
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n;
  for (int i(0); i < n; i++) {
    cin >> a[i];
  }
  for (int i(0); i < n; i++) {
    mk[i + 1] = mk[i] + a[i];
  }
  int ans = max(mk[n - 1], n - mk[n - 1]);
  for (int i(1); i <= n; i++) {
    ans = max(ans, n - mk[i - 1] - (n - i + 1 - (mk[n] - mk[i - 1])));
  }
  cout << ans << endl;
  return 0;
}
