Statement
Statement language
You process queries in order. In query , hire a new assassin numbered and choose an integer . If , assassin targets nobody. Otherwise, assassin targets the previously hired assassin .
After each query, assassin is dead if at least one living assassin targets . Otherwise, is alive. Thus, when an assassin who targets someone dies, their target may become alive again.
Find the number of living assassins after each query.
Input
The input is given in the following format:
Output
For each case, print the number of living assassins after each query, one per line.
Constraints
- .
- .
- .
Subtasks
Samples
Input
2
4
0
1
2
1
3
0
0
0
Output
1
1
2
2
1
2
3