# Sort Machine

Easy

Execution time limit is 1 second

Runtime memory usage limit is 128 megabytes

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.

## Input

The first line contains the number $n(n≤50)$. The second line contains $n$ integers in the range from $−1000$ to $1000$.

## Output

Print the minimum number of MOVE commands required to arrange all the numbers in ascending order.

Submissions 2K

Acceptance rate 25%