There is a machine for sorting a set of different numbers. It has only one command, MOVE, with one argument. This command moves the number specified in the argument to the end of the sequence. For example, to sort the array of numbers 19, 7, 8, 25 in ascending order, two commands should be performed:
MOVE 19, resulting in 7, 8, 25, 19.
MOVE 25, resulting in 7, 8, 19, 25.
For a given set of numbers, find the minimum number of MOVE commands required to arrange its elements in ascending order.
The first line contains the number (n \le 50). The second line contains integers in the range from to .
Print the minimum number of MOVE commands required to arrange all the numbers in ascending order.
Example 1