#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a = 0, b = 0;
  while (n--) {
    int x;
    cin >> x;
    if (x)
      a = max(a + 1, b + 1);
    else
      b++;
  }
  cout << max(a, b);
}
