#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int NIL = -1;
template <class T>
inline T mx(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T mi(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline void sw(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
template <class T>
inline T mabs(T x) {
  return x < 0 ? -x : x;
}
inline char gc() {
  char ret;
  while ((ret = getchar()) == ' ' || ret == '\n' || ret == '\t')
    ;
  return ret;
}
int dat[110];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> dat[i];
  int ans = INF;
  for (int i = 0; i <= n; i++) {
    int tmp = 0;
    for (int j = 0; j < i; j++)
      if (dat[j] == 1) tmp++;
    for (int j = i; j < n; j++)
      if (dat[j] == 0) tmp++;
    ans = mi(ans, tmp);
  }
  cout << n - ans;
  return 0;
}
