A Little Bit of Formal Statements Never Hurt Anybody
You are given an array of pairwise distinct integers .
Count the number of pairs where and is the position of the maximum element among .
Input
The first line contains a single integer () — the length of the array .
The second line contains integers () — elements of the array .
It is guaranteed that all integers in the array are pairwise distinct.
Output
Output a single integer — the amount of pairs described in the statement.
Examples
Note
In the first example, the array is . There are pairs which satisfy the statement:
, ; in this case equals , because is the maximum between ; the pair , holds the statement, since ;
, ;
, ;
, ;
, ;
, .
Scoring
( points): ;
( points): ;
( points): ;
( points): there exists , such that and ;
( points): ;
( points): array consists of random integers ;
( points): no additional restrictions.