Level Nodes

2.5

6 votes
Very-Easy
Problem

You have been given a Tree consisting of N nodes. A tree is a fully-connected graph consisting of N nodes and N1 edges. The nodes in this tree are indexed from 1 to N. Consider node indexed 1 to be the root node of this tree. The root node lies at level one in the tree. You shall be given the tree and a single integer x . You need to find out the number of nodes lying on level x.

Input Format

The first line consists of a single integer N denoting the number of nodes in the tree. Each of the next n1 lines consists of 2 integers a and b denoting an undirected edge between node a and node b. The next line consists of a single integer x.

Output Format

You need to print a single integers denoting the number of nodes on level x.

Constraints

1N105

1a,bN

Note

It is guaranteed that atleast one node shall lie on level x

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?