#C4005. Maximum Consecutive Ones

    ID: 47496 Type: Default 1000ms 256MiB

Maximum Consecutive Ones

Maximum Consecutive Ones

You are given a binary array consisting only of 0s and 1s. Your task is to determine the maximum number of consecutive 1s in the array.

Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).

For example, if the array is [1, 1, 0, 1, 1, 1], the result is 3 because the longest sequence of consecutive 1s has length 3.

Input Format: The first line contains an integer \(n\) denoting the number of elements in the array. The second line contains \(n\) space-separated integers, each being either 0 or 1.

Output Format: Print a single integer representing the maximum number of consecutive 1s in the array.

inputFormat

The first line contains an integer \(n\), the number of elements in the array. The second line contains \(n\) space-separated binary integers (0 or 1).

outputFormat

Output a single integer which is the maximum count of consecutive 1s in the array.

## sample
4
1 1 1 1
4