Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of the day and a_i=1 if Polycarp rests during the i-th hour of the day.

Days go one after another endlessly and Polycarp uses the same schedule for each day.

What is the maximal number of continuous hours during which Polycarp rests? It is guaranteed that there is at least one working hour in a day.

Input

The first line contains n (1 ≤ n ≤ 2⋅10^5) — number of hours per day.

The second line contains n integer numbers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 1), where a_i=0 if the i-th hour in a day is working and a_i=1 if the i-th hour is resting. It is guaranteed that a_i=0 for at least one i.

Output

Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day.

Examples

Input


5
1 0 1 0 1


Output


2


Input


6
0 1 0 1 1 0


Output


2


Input


7
1 0 1 1 1 0 1


Output


3


Input


3
0 0 0


Output


0

Note

In the first example, the maximal rest starts in last hour and goes to the first hour of the next day.

In the second example, Polycarp has maximal rest from the 4-th to the 5-th hour.

In the third example, Polycarp has maximal rest from the 3-rd to the 5-th hour.

In the fourth example, Polycarp has no rest at all.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.security.AccessControlException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;
public class _p001141B {
    static public void main(final String[] args) throws IOException {
        p001141B._main(args);
    }
//begin p001141B.java
static private class p001141B extends Solver{public p001141B(){nameIn="in/900/p001141B.in"
;singleTest=true;}int n;int[]a;@Override protected void solve(){PriorityQueue<Integer>
pq=new PriorityQueue<>((x,y)->y-x);int start=0;int i=0;for(;i<n&&a[i]==1;i++){start++
;}int next=0;for(;i<n;i++){if(a[i]==0&&next>0){pq.add(next);next=0;}else if(a[i]
==1){next++;}}pq.add(next+start);pw.println(pq.poll());}@Override public void readInput
()throws IOException{n=sc.nextInt();if(sc.hasNextLine()){sc.nextLine();}a=Arrays
.stream(sc.nextLine().trim().split("\\s+")).mapToInt(Integer::valueOf).toArray()
;}static public void _main(String[]args)throws IOException{new p001141B().run();
}}
//end p001141B.java
//begin net/leksi/contest/Solver.java
static private abstract class Solver{protected String nameIn=null;protected String
nameOut=null;protected boolean singleTest=false;protected boolean preprocessDebug
=false;protected boolean doNotPreprocess=false;protected PrintStream debugPrintStream
=null;protected Scanner sc=null;protected PrintWriter pw=null;final String SPACE
=" ";final String SPACES="\\s+";private void process()throws IOException{if(!singleTest
){int t=lineToIntArray()[0];while(t-->0){readInput();solve();}}else{readInput();
solve();}}abstract protected void readInput()throws IOException;abstract protected
void solve()throws IOException;protected int[]lineToIntArray()throws IOException
{return Arrays.stream(sc.nextLine().trim().split(SPACES)).mapToInt(Integer::valueOf
).toArray();}protected long[]lineToLongArray()throws IOException{return Arrays.stream
(sc.nextLine().trim().split(SPACES)).mapToLong(Long::valueOf).toArray();}protected
String joinToString(final int[]a){return Arrays.stream(a).mapToObj(Integer::toString
).collect(Collectors.joining(SPACE));}protected String joinToString(final long[]
a){return Arrays.stream(a).mapToObj(Long::toString).collect(Collectors.joining(SPACE
));}protected<T>String joinToString(final T[]a){return Arrays.stream(a).map(v->Objects
.toString(v)).collect(Collectors.joining(SPACE));}protected<T>String joinToString
(final T[]a,final Function<T,String>toString){return Arrays.stream(a).map(v->toString
.apply(v)).collect(Collectors.joining(SPACE));}protected<T>String joinToString(final
Collection<T>a){return a.stream().map(v->Objects.toString(v)).collect(Collectors
.joining(SPACE));}protected<T>String joinToString(final Collection<T>a,final Function<T
,String>toString){return a.stream().map(v->toString.apply(v)).collect(Collectors
.joining(SPACE));}protected<T>String joinToString(final Stream<T>a){return a.map
(v->Objects.toString(v)).collect(Collectors.joining(SPACE));}protected<T>String joinToString
(final Stream<T>a,final Function<T,String>toString){return a.map(v->toString.apply
(v)).collect(Collectors.joining(SPACE));}protected<T>String joinToString(final IntStream
a){return a.mapToObj(Integer::toString).collect(Collectors.joining(SPACE));}protected
<T>String joinToString(final LongStream a){return a.mapToObj(Long::toString).collect
(Collectors.joining(SPACE));}protected List<Long>intArrayToLongList(final int[]a
){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors.toList());}
protected List<Integer>toList(final int[]a){return Arrays.stream(a).mapToObj(Integer
::valueOf).collect(Collectors.toList());}protected List<Integer>toList(final IntStream
a){return a.mapToObj(Integer::valueOf).collect(Collectors.toList());}protected List<Long>
toList(final long[]a){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors
.toList());}protected List<Long>toList(final LongStream a){return a.mapToObj(Long
::valueOf).collect(Collectors.toList());}protected<T>List<T>toList(final Stream<T>
a){return a.collect(Collectors.toList());}protected<T>List<T>toList(final T[]a){
return Arrays.stream(a).collect(Collectors.toList());}protected void run()throws
IOException{boolean done=false;try{if(nameIn !=null&&new File(nameIn).exists()){
try(FileInputStream fis=new FileInputStream(nameIn);PrintWriter pw0=select_output
();){done=true;sc=new Scanner(fis);pw=pw0;process();}}}catch(IOException ex){}catch
(AccessControlException ex){}if(!done){try(PrintWriter pw0=select_output();){sc=
new Scanner(System.in);pw=pw0;process();}}}private PrintWriter select_output()throws
FileNotFoundException{if(nameOut !=null){return new PrintWriter(nameOut);}return
new PrintWriter(System.out);}}
//end net/leksi/contest/Solver.java
}
