#include <bits/stdc++.h>
using namespace std;
int a[100005] = {};
bool srt(const pair<int, int> &lhs, const pair<int, int> &rhs) {
  return lhs.second > rhs.second;
}
int z[1000] = {};
int o[1000] = {};
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    o[i] = o[i + 1] + a[i];
  }
  if (a[0] == 0) z[0] = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] == 0)
      z[i] = z[i - 1] + 1;
    else
      z[i] = z[i - 1];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, z[i] + o[i]);
  }
  cout << ans;
}
