Given an undirected tree with N nodes rooted at node 1, every node is assigned a color which is either black denoted by 1 or white denoted by 0.
We will apply Q operations on the tree as follows:
After Q operations on the tree, find the number of nodes which are colored black.
Input
Output
Print an integer, denoting the number of nodes which are colored black after applying Q operations on the tree.
Constraints
1≤N,Q≤1051≤u,v≤Nu≠v1≤X≤N
After first operation on node 2, the color of nodes will be as follows:
After second operation on node 5, the color of nodes will be as follows:
Therefore, after Q operations 2 nodes are colored black.