#include <bits/stdc++.h>
using namespace std;
int n, a[1010];
inline int calcupto(int now) {
  int res = 0;
  for (int i = 0; i <= now; ++i)
    if (a[i] == 1) ++res;
  for (int i = now + 1; i < n; ++i)
    if (a[i] == 0) ++res;
  return n - res;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int res = 0;
  for (int i = -1; i < n; ++i) {
    if (i == -1 || a[i] == 0) {
      res = max(res, calcupto(i));
    }
  }
  if (*min_element(a, a + n) == 1) return cout << n, 0;
  cout << res << '\n';
}
