#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long n;
  cin >> n;
  vector<long long> arr(n, 0);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long remaining = n;
    for (long long j = i - 1; j >= 0; j--) {
      if (arr[j] == 1) {
        --remaining;
      }
    }
    for (long long k = i + 1; k < n; k++) {
      if (arr[k] == 0) {
        --remaining;
      }
    }
    ans = max(ans, remaining);
  }
  cout << ans;
  return 0;
}
