#include <bits/stdc++.h>
using namespace std;
int a[105];
int cnt[2];
int n;
int main() {
  while (~scanf("%d", &n)) {
    int p = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      cnt[a[i]]++;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      int tot = 0;
      if (a[i]) {
        for (int j = 1; j <= i; j++)
          if (!a[j]) tot++;
        for (int j = i; j <= n; j++)
          if (a[j]) tot++;
      }
      ans = max(ans, tot);
    }
    printf("%d\n", max(cnt[0], ans));
    cnt[0] = cnt[1] = 0;
  }
  return 0;
}
