#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const int MAX = (int)1e2 + 5;
void build() { return; }
int n;
int store[MAX];
void Init() {
  scanf("%d", &n);
  for (int i = (1); i < (n + 1); ++i) scanf("%d", store + i);
  return;
}
int l[MAX], r[MAX];
void sol() {
  for (int i = (1); i < (n + 1); ++i) {
    l[i] = l[i - 1];
    if (!store[i]) l[i]++;
  }
  for (int i = n; i >= 1; --i) {
    r[i] = r[i + 1];
    if (store[i]) r[i]++;
  }
  int ans = 0;
  for (int i = (1); i < (n + 2); ++i) {
    ans = max(ans, l[i - 1] + r[i]);
  }
  cout << ans << endl;
  return;
}
int main(void) {
  Init();
  build();
  sol();
  return 0;
}
