#include <bits/stdc++.h>
using namespace std;
int a[105], b[105];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  int t = a[0], cnt = 1, ms = 0;
  a[n] = 10;
  for (int i = 1; i <= n; i++) {
    if (a[i] != t) {
      if (t > 0) {
        b[ans++] = cnt;
        ms++;
      } else
        b[ans++] = -cnt;
      t = a[i];
      cnt = 1;
    } else
      cnt++;
  }
  int sum = 0;
  for (int j = 0; j <= ms; j++) {
    int ks = 0, mms = 0;
    for (int i = 0; i < ans; i++) {
      if (b[i] > 0) mms++;
      if (mms <= j && b[i] < 0)
        ks += abs(b[i]);
      else if (mms > j && b[i] > 0)
        ks += abs(b[i]);
    }
    sum = max(sum, ks);
  }
  int ks = 0;
  for (int i = 0; i < ans; i++) {
    if (b[i] > 0) ks++;
  }
  sum = max(sum, ks);
  cout << sum << endl;
  return 0;
}
