Maximum Consecutive Ones - 1

easy
1. You are given an array(arr) which contains only 0's and 1's.
2. You have to find the maximum number of consecutive 1's in the given array if you can flip at most one zero.

Input Format

A number N arr1 arr2... N numbers

Output Format

A number representing maximum number of consecutive 1's after flipping at most one zero.

Constraints

1 <= N <= 10^5
0 <= arr[i] <= 1

Example

Input
6
1 1 0 0 1 1
Output
3
Previous
Equivalent Subarrays
Next
Maximum Consecutive Ones - 2

Related Questions