## E - Many Operations

We have a variable and kinds of operations that change the value of . Operation is represented as a pair of integers , and is the following operation:

• if , it replaces the value of with ;
• if , it replaces the value of with ;
• if , it replaces the value of with .

Initialize with the value of and execute the following procedures in order:

• Perform Operation , and then print the resulting value of .
• Next, perform Operation in this order, and then print the value of .
• Next, perform Operation in this order, and then print the value of .
• Next, perform Operation in this order, and then print the value of .

Constraints

• All values in input are integers.

Sample Input

Sample Output

The initial value of is .

Operation changes to .
Next, Operation changes to , and then Operation changes it to .
Next, Operation changes to , and then Operation changes it to , and then Operation changes it to .

## F - Sorting Color Balls

There are balls arranged from left to right.
The color of the -th ball from the left is Color , and an integer is written on it.
Takahashi wants to rearrange the balls so that the integers written on the balls are non-decreasing from left to right.
In other words, his objective is to reach a situation where, for every , the number written on the -th ball from the left is greater than or equal to the number written on the -th ball from the left.
For this, Takahashi can repeat the following operation any number of times (possibly zero):

Choose an integer such that .
If the colors of the -th and -th balls from the left are different, pay a cost of .
(No cost is incurred if the colors are the same).
Swap the -th and -th balls from the left.

Find the minimum total cost Takahashi needs to pay to achieve his objective.

Constraints

• All values in input are integers.

Sample Input

Sample Output