#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
int n;
int v[105];
int dp[105][5];
int solve(int pos, int last) {
  if (pos >= n) return 0;
  int &r = dp[pos][last + 1];
  if (r != -1) return r;
  int L = -INF;
  if (!(last == 1 and v[pos] == 0)) L = solve(pos + 1, v[pos]) + 1;
  int R = solve(pos + 1, last);
  return r = max(L, R);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> v[i];
  memset(dp, -1, sizeof dp);
  cout << solve(0, -1) << '\n';
  return 0;
}
