#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a[100], mx = 0, s0 = 0, s1 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx += a[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      s0++;
      s1 = 0;
      for (int j = i + 1; j < n; j++) {
        s1 += a[j];
      }
      if (s0 + s1 > mx) mx = s0 + s1;
    }
  }
  cout << mx;
  return 0;
}
