#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j;
  long long N;
  cin >> N;
  long long prev = -1;
  long long ans = 0;
  long long arr[123];
  long long left[123];
  long long right[123];
  memset(left, 0, sizeof left);
  memset(right, 0, sizeof right);
  for (i = 1; i <= N; i++) cin >> arr[i];
  for (i = 1; i <= N; i++) {
    left[i] = left[i - 1];
    if (arr[i] == 0) left[i]++;
  }
  for (i = N; i >= 0; i--) {
    right[i] = right[i + 1];
    if (arr[i] == 1) right[i]++;
  }
  for (i = 1; i <= N; i++) ans = max(ans, left[i - 1] + right[i]);
  for (i = 1; i <= N; i++) ans = max(ans, left[i] + right[i + 1]);
  cout << ans;
  return 0;
}
