#include <bits/stdc++.h>
using namespace std;
int n, a[105], pos[105];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      pos[i] = 1;
    }
    pos[i] += pos[i - 1];
  }
  int ans = max(pos[n], n - pos[n]);
  for (int i = 1; i <= n; i++) {
    ans = max(ans, i - pos[i] + pos[n] - pos[i]);
  }
  cout << ans << endl;
}
