~/algor $ cat problems/minmax-32-min-va-max-orasidagi-masofa
Distance between the first minimum and maximum
Easy
1000 ms
128 MB
26%
A positive integer $N$ and $N$ integers are given. Let $p$ be the position (indexed from $1$) of the first smallest element and $q$ the position of the first largest element. Find $|p - q|$.
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 1000$
$-10^{9} \le A_{i} \le 10^{9}$
Examples
Input #1
6 4 1 6 8 2 8
Output #1
2
Input #2
1 7
Output #2
0