#include <bits/stdc++.h>
using namespace std;
int a[100];
int main() {
  int n, ret = 0, n0 = 0, n1 = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) n1 += a[i];
  ret = max(n1, n - n1);
  for (int i = 0; i < n; i++) {
    if (a[i]) {
      ret = max(ret, n0 + n1);
      n1--;
    } else {
      n0++;
    }
  }
  printf("%d\n", ret);
  return 0;
}
