Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/minmax-34-maksimumning-eng-uzun-qatori

Longest run of the maximum

Medium 1000 ms 128 MB 58%
Share

A positive integer $N$ and $N$ integers are given. Find the greatest length of a segment of consecutive elements, each of which is equal to the largest value.

The longest segment of consecutive elements equal to the largest value

Input

The first line contains a positive integer $N$. The next line contains $N$ integers $A_{i}$.

Output

One integer.

Note

$1 \le N \le 10^{5}$
$-10^{9} \le A_{i} \le 10^{9}$

Examples

Input #1
9
5 7 7 2 7 7 7 1 7
Output #1
3
Input #2
4
-1 3 -1 2
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.