Selection Sort#178

Selection Sort

1 second
64 megabytes
Easy (≈1000)

The array is sorted in ascending order using the Selection Sort method. How many times does the first element change its position?

Input

The first line contains the number of elements in the array (1 ≤ n ≤ 1000). The second line gives the array itself. It is guaranteed that all elements of the array are distinct and do not exceed 10^9 in absolute value.

Output

Print the number of times the first element changes its position.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading