#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e2 + 7;
int n, out, act;
int s[MAX_N];
int ile0[MAX_N], ile1[MAX_N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
  }
  act = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 0) {
      act++;
    }
    ile0[i] = act;
  }
  act = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 1) {
      act++;
    }
    ile1[i] = act;
  }
  for (int i = 0; i < n; i++) {
    out = max(out, ile0[i] + ile1[i]);
  }
  printf("%d\n", out);
}
