#include <bits/stdc++.h>
int n, s[102], c0[102], c1[102];
int main() {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &s[i]);
  for (i = 1; i <= n; i++) c0[i] = c0[i - 1] + (s[i] == 0);
  for (i = n; i >= 1; i--) c1[i] = c1[i + 1] + s[i];
  int ans = 0;
  for (i = 0; i <= n; i++)
    if (ans < c0[i] + c1[i + 1]) ans = c0[i] + c1[i + 1];
  printf("%d", ans);
  return 0;
}
