#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int vec[101];
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  int max1 = 0, i = 0, pos, max2 = 0, maxt;
  int temp, j = 0, max = 0;
  temp = 0;
  while (j < n) {
    max1 = 0;
    max2 = 0;
    i = j;
    while (vec[i] == 0 && i < n) {
      temp++;
      i++;
      j++;
    }
    pos = i;
    while (i < n) {
      if (vec[i] == 1) {
        max1++;
      }
      if (vec[i] == 0) max2++;
      i++;
    }
    if (max1 > max2)
      maxt = temp + max1;
    else
      maxt = temp + max2;
    if (maxt > max) max = maxt;
    while (vec[j] == 1 && j < n) j++;
  }
  while (vec[j] == 1 && j < n) j++;
  cout << max;
  return 0;
}
