#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 30, Mod = 1e9 + 7;
const long long SQ = 330;
long long a[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int x = 0; x <= n; x++) {
    long long p = 0;
    for (int i = 0; i < n; i++) {
      if (i < x and a[i] == 0)
        p++;
      else if (x <= i and a[i])
        p++;
    }
    ans = max(ans, p);
  }
  cout << ans;
  return (0);
}
