B. Color
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

There are $$$n$$$ objects with different colors in a row. We use integers in $$$[1,n]$$$ to represent different colors. Now you can do operations like below:

Choose any number of objects with the same color, and change their colors arbitrarily. You must guarantee that after the operation, colors of objects you chose are $$$\bf{non-decreasing}$$$, i. e. that each element is not less than the previous $$$\bf{selected}$$$ element.

Calculate the minimum number of operations to make the whole color sequence $$$\bf{non-decreasing}$$$.

For example, for the color sequence $$$[1,5,4,5,5,3,5]$$$, choose first three objects with color $$$5$$$, and change them to $$$1,3,3$$$ $$$($$$ $$$1\leq 3 \leq 3$$$ $$$)$$$, the sequence will turn into $$$[1,1,4,3,3,3,5]$$$. Then choose the objects with color $$$4$$$ and change it into $$$2$$$, the whole sequence will become $$$[1,1,2,3,3,3,5]$$$ and satisfy our goal.

Input

First line contains an integer $$$n$$$ $$$($$$ $$$1\leq n \leq 2 \times 10^{5}$$$ $$$)$$$.

Second line contains $$$n$$$ integers $$$c_1,c_2,...,c_n$$$ $$$($$$ $$$1\leq c_i \leq n$$$ $$$)$$$, $$$c_i$$$ represents the color of the $$$i$$$ th object.

Output

Print one integer$$$-$$$ the minimum number of operations to make the whole color sequence non-decreasing.

Examples
Input
5
1 2 3 1 2
Output
2
Input
5
1 5 2 5 1
Output
2
Input
10
5 1 2 4 1 4 4 9 2 6
Output
4