#include <bits/stdc++.h>
using namespace std;
vector<int> V;
int main() {
  int n;
  cin >> n;
  int a1 = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    V.push_back(a);
    if (a == 0) a1++;
  }
  int ans = 0;
  int k = n;
  for (int i = 0; i < n; i++) {
    ans = max(ans, k - a1);
    if (V[i] == 1)
      k--;
    else
      a1--;
  }
  ans = max(ans, k - a1);
  cout << ans;
}
