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