#include <bits/stdc++.h>
using namespace std;
int n, arr[110], c1, c0;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]), c1 += arr[i];
  int out = 0;
  for (int i = 0; i < n; ++i) {
    c0 += (!arr[i]);
    out = max(out, c0 + c1);
    c1 -= arr[i];
  }
  cout << out;
}
