#include <bits/stdc++.h>
using namespace std;
int zero, unu, i, n, A[105];
int bkt(int l, int r) {
  int ze = 0, un = 0, i;
  if (r < l) return 0;
  if (l == r) return 1;
  if (A[r] == 1) return bkt(l, r - 1) + 1;
  if (A[l] == 0) return bkt(l + 1, r) + 1;
  for (i = l; i <= r; i++)
    if (A[i] == 0)
      ze++;
    else
      un++;
  return max(r - l + 1 - un, max(r - l + 1 - ze, bkt(l + 1, r - 1)));
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
  }
  cout << bkt(1, n);
  return 0;
}
