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