A target sequence of length is given.
Consider a working sequence of length . Initially, every is . You may perform the following operation any number of times.
The cost of is the minimum number of operations required to make the working sequence equal to the target sequence .
Then, update queries are given. Each query replaces one element of the target sequence with a new value. After each query, find the cost of the current target sequence .
When computing the cost after each query, the working sequence always starts with every element equal to . Operations performed for an earlier query do not carry over to a later query.
The input is given from Standard Input in the following format:
For each test case, print lines.
On the -th line, print the cost of the current target sequence immediately after applying the -th query.
In the first test case, the target sequence after each query is , , , and , respectively.
Each case is given in the following format:
The -th query replaces with .
| 25 |
The sum of over all test cases does not exceed . |
| 3 | 60 | No additional constraints. |
In the second test case, the single element of the target sequence becomes , , and , respectively.