#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e2;
int arr[MAX_N];
int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> arr[i];
  int res = 0;
  for (int i = 0; i <= N; i++) {
    int zerocnt = 0;
    int onecnt = 0;
    for (int t = 0; t < i; t++)
      if (arr[t] == 0) zerocnt++;
    for (int t = i; t < N; t++)
      if (arr[t] == 1) onecnt++;
    res = max(res, zerocnt + onecnt);
  }
  cout << res << endl;
}
