Problems
Minimum method
Minimum method
The array is sorted with selection sort in ascending order. How many times does the first element in initial array change its position?
Input data
The first line contains the number of elements in array n (1 ≤ n ≤ 1000). The second line contains the elements of array. It is known that all elements in array are different and not greater than 10^9
by absolute value.
Output data
Print the number of movements of the first element.
Examples
Input example #1
3 1 3 2
Output example #1
0
Input example #2
2 2 1
Output example #2
1
Input example #3
4 4 1 5 3
Output example #3
3