~/algor $ cat problems/minmax/distance-between-the-first-minimum-and-maximum
Distance between the first minimum and maximum
Easy
1000 ms
128 MB
26%
A positive integer and integers are given. Let be the position (indexed from ) of the first smallest element and the position of the first largest element. Find .
Input
The first line contains a positive integer . The next line contains integers .
Output
One integer.
Note
Examples
Input #1
6 4 1 6 8 2 8
Output #1
2
Input #2
1 7
Output #2
0