// Thomas Meeks
// 6/6/2023
// Finds length of largest streak of 1's given a list of 1's and 0's

// Input: N, followed by N numbers 0 or 1
// Output: A number stating the length of the largest streak of 1's
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int best = 0;
    int runningSum = 0;
    //Loop through and process all n numbers.
    for(int i = 0; i < n; i++){
        int v; cin >> v; //take in value (0 or 1)
        if(v == 1) //Could be if(v) since non 0 integers are boolean true
          runningSum++; //our current sequence is getting longer
        else
          runningSum = 0; //we have reached a 0 end of our current streak of 1's

        //our answer is gonna be the highest that running sum is at any point.
        best = max(best,runningSum);
    }
    //output the answer :)
    cout << best;
}