#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int answer = 0;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    int ans = 0;
    for (int j = i; j >= 0; j--) {
      if (arr[j] == 0) ans++;
    }
    for (int k = i; k < n; k++) {
      if (arr[k] == 1) ans++;
    }
    answer = max(answer, ans);
  }
  cout << answer << endl;
}
