#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 5;
int main() {
  int n, a[mxn];
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int cnt = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i])
      ++cnt;
    else {
      ans = max(ans, cnt);
      cnt = 0;
    }
  }
  if (cnt) {
    for (int i = 0; a[i]; ++i, ++cnt)
      ;
  }
  cout << max(ans, cnt);
}
