Marisa lives in the Magic Forest, which can be visualized as a tree with $n$ vertices. Her house is located at vertex $1$. Over the next $n$ days, Marisa plans to visit a different vertex each day to harvest mushrooms. Specifically, on day $i$, she will travel to vertex $A_i$. During her journey to harvest mushrooms, Marisa wants to keep track of the number of vertices where she has already collected mushrooms. Can you assist her in counting this number?
Input:
5
1 4
5 4
1 3
2 4
4 2 1 5 3
Output:
0
1
0
2
1