AlgoUniversity
  • Go Back
Discussion
Birthday Treat :

Author

Yash Sahijwani

Difficulty Level : Easy

Submissions : 175

Asked In : Virtusa

Marks :10

: 1 | : 0

It is Rob's birthday and he is very excited about the night's birthday party. The city in which Rob lives has N blocks. The roads of this city are made in such a way that there is only one route from one city to another. Rob only has friends from all the dead ends of the city.

It is evening and Rob only wants to call the friends who live nearest to his house. Nearest houses are those which are at the same distance from Rob's house as the nearest dead end.

Rob lives in block 0. Help him find out the number of friends he can call for the birthday party.

Input

The first line of input consists of a single integer $$$N$$$ $$$(1 \leq N \leq 10^6)$$$ - the total number of blocks in the city. Each of the next $$$N-1$$$ lines consists of two integers, $$$a_i$$$ and $$$b_i$$$, $$$(0 \leq a_i, b_i \leq N-1)$$$ denoting that there is a road between blocks $$$a_i$$$ and $$$b_i$$$.

Output

The output should consist of a single integer, the total number of blocks in the city from which Rob can call friends.

Examples

Input
5
0 1
1 2
1 3
1 4
Output
3
Input
5
0 1
1 2
1 3
3 4
Output
1

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.