#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
const int mod69 = 1e9 + 696969;
int n, t[1000010];
void wczytaj() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> t[i];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  wczytaj();
  int WYN = 0;
  for (int i = 0; i < n; ++i)
    if (t[i] == 0) WYN++;
  for (int i = 0; i < n; ++i) {
    int akt1 = 0, akt2 = 0;
    for (int j = 0; j < i; ++j) {
      if (t[j] == 0) akt1++;
    }
    for (int j = i; j < n; ++j) {
      if (t[j] == 1) akt2++;
    }
    WYN = max(WYN, akt1 + akt2);
  }
  cout << WYN;
}
