Task - help

Can anyone help with this task.

Given a sequence of N different integers. Operations allowed members of the series are:

Move to the beginning of the sequence

Move to the end of the sequence

Print the smallest number of necessary operations to a default set of ascending sorted.

For example:

Input

4 3 4 2 1

Output

2

Thank you.

@lovro_sinda
can you be more specific what actually you want to ask or can you provide link to the problem which you are trying to solveā€¦:smiley:

Hello, lovro_sinda, here, in this example the smallest number is 1, you are saying to make some operations, but it is not clear how the output 2 came, so please write the full question, I will surely help you.