#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = INF * (long long)INF;
const int MAX = 2 * 1000 + 47;
const int MOD = 1000 * 1000 + 3;
int A[MAX];
int n;
int calc(int k) {
  int cnt0 = 0;
  for (int i = (0); i < (k); i++) {
    cnt0 += A[i] == 0;
  }
  int cnt1 = 0;
  for (int i = (k); i < (n); i++) {
    cnt1 += A[i] == 1;
  }
  return cnt0 + cnt1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (0); i < (n); i++) {
    cin >> A[i];
  }
  int ans = 0;
  for (int k = (0); k < (n + 1); k++) {
    ans = max(ans, calc(k));
  }
  cout << ans << endl;
}
