#include <bits/stdc++.h>
using namespace std;
int s[109];
int main() {
  int n, c2 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i]) c2++;
  }
  int i = 0, j = n - 1, ans = 0;
  int c0 = 0, c1 = 0, c = 0;
  while (i <= j) {
    c = max(c, (c0 + c2 - c1));
    if (s[i] == 0) {
      c0++;
    }
    if (s[i] == 1) {
      c1++;
    }
    i++;
  }
  c = max(c, (c0 + c2 - c1));
  ans += c;
  cout << ans << endl;
}
