#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const long long MOD = 1e9 + 7;
const long long N = 1e5 + 30;
const long long inf = 1e17 + 995;
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
template <typename T>
T exp(T b, T p) {
  T x = 1;
  while (p) {
    if (p & 1) x = (x * b);
    b = (b * b);
    p = p >> 1;
  }
  return x;
}
inline long long ones(long long n) {
  long long res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
void boostIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long cache[111][3], arr[111], n;
long long dp(long long idx, long long last) {
  if (idx == n) return 0;
  long long &ret = cache[idx][last];
  if (ret != -1) return ret;
  ret = 0;
  ret = dp(idx + 1, last);
  if (arr[idx] == 1 || (last != 1)) ret = max(ret, 1 + dp(idx + 1, arr[idx]));
  return ret;
}
int32_t main() {
  boostIO();
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  memset(cache, -1, sizeof(cache));
  long long ans = dp(0, 2);
  cout << ans;
}
