# Sort Machine

# Sort Machine

We have a sorting machine that works on a list of distinct numbers. This machine only has one instruction named MOVE that takes one element of the list as a parameter. The MOVE instruction removes the element from the list and then appends it to the end of the remaining list.

For example, the sequence 19, 7, 8, 25 can be sorted in ascending order using 2 instructions:

MOVE 19, to get 7, 8, 25, 19

MOVE 25, to get 7, 8, 19, 25

You will be given a list of distinct numbers. Return the minimum number of instructions required to sort the list in ascending order.

** Input**

The first line contains the size of the list **N** (**N** ≤ **50**). The next line contains **N** distinct integers - the elements of the list. All numbers in a list are integers between **-1000** and **1000**

** Output**

Print the minimum number of instructions required to sort the list in ascending order.

3 1000 -1000 0

1