#include <bits/stdc++.h>
using namespace std;
const int N = 1000007, inf = 0x3f3f3f3f;
int v[107];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> v[i];
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    int aux = n;
    for (int j = 0; j < n; ++j) {
      if (j < i and v[j] == 1) aux--;
      if (j >= i and v[j] == 0) aux--;
    }
    ans = max(ans, aux);
  }
  cout << ans << endl;
}
