#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int maxn = 1e6 + 10, maxm = 2e6 + 10;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
int casn, n, m, k;
int num[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> num[i];
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    int cnt = 0;
    for (int j = 1; j <= i; ++j) cnt += num[j] == 0;
    for (int j = i + 1; j <= n; ++j) cnt += num[j] == 1;
    ans = max(ans, cnt);
  }
  cout << ans << '\n';
}
