#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  deque<int> v;
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    v.push_back(k);
  }
  int sol = 0;
  for (int i = 0; i <= n; ++i) {
    int count = 0;
    for (int j = 0; j < i; ++j) {
      if (v[j] == 0) {
        count++;
      }
    }
    for (int j = i; j < n; ++j) {
      if (v[j] == 1) {
        count++;
      }
    }
    sol = max(sol, count);
  }
  cout << sol << endl;
  return 0;
}
