Problem: You are given a permutation .
In one move you can swap two adjacent values.
You want to perform a minimum number of moves, such that in the end there will exist a subsegment , in other words in the end there should be an integer , such that .
Let be the minimum number of moves that you need to make a subsegment with values appear in the permutation.
You need to find .
Input Format: The first line of input contains one integer (): the number of elements in the permutation.
The next line of input contains integers : given permutation ().
Output Format: Print integers, the minimum number of moves that you need to make a subsegment with values appear in the permutation, for .