#abc240d. [abc240_d]Strange Balls
[abc240_d]Strange Balls
Problem Statement
Takahashi has balls. Each ball has an integer not less than written on it. He will insert them in a cylinder one by one. The integer written on the -th ball is .
The balls are made of special material. When balls with written on them line up in a row, all these balls will disappear.
For each , find the number of balls after inserting the -th ball.
Constraints
- $2 \\leq a_i \\leq 2 \\times 10^5 \\, (1 \\leq i \\leq N)$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the number of balls after inserting the -th ball.
Sample Input 1
5
3 2 3 2 2
Sample Output 1
1
2
3
4
3
The content of the cylinder changes as follows.
- After inserting the -st ball, the cylinder contains the ball with .
- After inserting the -nd ball, the cylinder contains from bottom to top.
- After inserting the -rd ball, the cylinder contains from bottom to top.
- After inserting the -th ball, the cylinder contains from bottom to top.
- After inserting the -th ball, the cylinder momentarily has from bottom to top. The two consecutive balls with disappear, and the cylinder eventually contains from bottom to top.
Sample Input 2
10
2 3 2 3 3 3 2 3 3 2
Sample Output 2
1
2
3
4
5
3
2
3
1
0