#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long sa = 0, se = 0;
  long long a[n];
  for (long long j = 0; j < n; j++) {
    cin >> a[j];
  }
  long long ans = 1000000007;
  for (long long i = 0; i < n; i++) {
    long long x = 0;
    if (a[i] == 0) {
      for (long long j = 0; j <= i; j++) {
        if (a[j] == 1) x++;
      }
      for (long long j = i + 1; j < n; j++) {
        if (a[j] == 0) x++;
      }
    } else {
      for (long long j = 0; j < n; j++) {
        if (a[j] == 0) x++;
      }
    }
    ans = min(ans, x);
  }
  cout << n - ans << endl;
  return 0;
}
