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.