Brush Hour


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

Did you know that in Adelaide, pride month is in November? To prepare for this year's upcoming pride, the mayor has tasked you with painting the town all sorts of colors.

Adelaide can be represented as a tree, consisting of n buildings, numbered from 1 to n, with n-1 roads connecting them. To color the buildings, you have a powerful tool at your disposal: paint bombs. When you set off a bomb at a building, that building itself and all buildings directly connected to it by a single road, will get splattered in bright paint.

As fun as this is, you don't want to waste any paint! What is the minimum number paint bombs needed to color every building in the city?

Input

The first line contains an integer n (1 \leq n \leq 10^5), the number of buildings in Adelaide.

The next n-1 lines contain two integers A and B (1 \leq A, B \leq n), indicating that there is a bidirectional road between buildings A and B.

Output

Output the minimum number of paint bombs required to paint the entire town.

Example

Input 1
7
1 2
2 3
3 4
3 5
5 6
6 7
Output 1
3

3 paint bombs, placed at buildings 2 (red), 3 (yellow) and 6 (blue) can paint the whole town, as shown below.

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

1 paint bomb, placed at building 3, can paint the whole town.

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

2 paint bombs, placed at buildings 2 and 4, can paint the whole town.


Comments

There are no comments at the moment.