Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/minmax/numbers-after-the-last-maximum

Numbers after the last maximum

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Easy 1000 ms 256 MB 27%
Share

A positive integer and integers are given. Find the number of elements after the last occurrence of the largest element.

Counting the elements after the last maximum

Input

The first line contains an integer . The next line contains integers .

Output

One integer — the number of elements after the last maximum.

Note


Examples

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

Sign in to submit a solution

Signing up is free and takes a minute.