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