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.
- Choose two integers satisfying .
- Choose to be either or .
- Add to for every .
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.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
The -th query replaces with .
Output
For each test case, print lines.
On the -th line, print the cost of the current target sequence immediately after applying the -th query.
Constraints
- .
- .
- .
- ().
- ().
- ().
- The sum of over all test cases does not exceed .
- The sum of over all test cases does not exceed .
Subtasks
Samples
In the first test case, the target sequence after each query is , , , and , respectively.
In the second test case, the single element of the target sequence becomes , , and , respectively.