Now input a positive number n,then you can get n numbers from 1 to n,they are all different and they are in a wrong queue,so you should arrangement them from small to large.The condition is that you can only change two adjacent numbers.
Input until EOF.
Input a positive number n(3<=n<=2000) the first line.
Then in the next line followed n numbers about 1 to n.
You should output the minimum times you make them from small to large.