#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
const int MAXN = 212345;
int n, m, k;
int s[MAXN];
int main() {
  scanf("%d", &n);
  for (int a = 0; a < n; a++) {
    scanf("%d", s + a);
  }
  int mx = 0;
  for (int i = 0; i <= n; i++) {
    int cnt = 0;
    for (int a = 0; a < n; a++) {
      if (a < i)
        cnt += (s[a] == 0);
      else
        cnt += (s[a] == 1);
    }
    mx = max(mx, cnt);
  }
  printf("%d\n", mx);
}
