Question
Product Stretch

Alice is passionate about patterns! She seeks the longest subarray with a non-zero product in an array A of N elements: A1, A2, ..., AN. A subarray Aij includes elements from index i to j: Ai, Ai+1, ..., Aj. The product of Aij is the product of all its elements from i to j.

Input
The first line of the input contains single integer N denoting the number of elements.
Second line contains N space-separated integers A1, A2, ..., AN denoting the elements of an array.
Output
Print an integer - the maximal length of subarray with non-zero product.
Example
Input
6
1 0 2 3 0 4
Output
2
Explanation
The subarray [2, 3] has non-zero product and is of maximum possible size.

Online