Chasing a butterfly#11058

Chasing a butterfly

2 seconds
128 megabytes
Easy

On clear summer days, Nyusha enjoys catching butterflies in the fresh air. But today, she encountered a particularly cunning butterfly — it flew into a labyrinth and tried to hide from her inside.

The labyrinth consists of rooms, numbered from to , some of which are connected by corridors. It is known that there is exactly one simple path between any two rooms, passing only through the corridors. In other words, the labyrinth forms a tree with vertices and n - 1 edges.

The entrance to the labyrinth is located in room number . A leaf is defined as any room connected to exactly one other room and not being the root (i.e., not room ). Each leaf contains an exit from the labyrinth. The butterfly starts its flight from room , heading toward one of the exits. It moves at a constant speed, never turns around, and travels through one corridor per minute, moving to a neighboring room. All corridors are of equal length.

To catch the butterfly, Nyusha decided to enlist the help of some friends. Initially, each of them can take position in any room that contains an exit. As soon as the butterfly begins its journey from the entrance toward some exit, the friends may immediately start moving from their rooms toward the entrance. They move at the same speed as the butterfly. If any of them encounters the butterfly — whether in a room or in the middle of a corridor — it is considered caught. However, if the butterfly reaches an exit without encountering any of the friends, it successfully escapes to freedom.

Help Nyusha determine the minimum number of friends needed to guarantee catching the butterfly, regardless of which exit it chooses.

Input

The first line contains a single integer n~(2 \le n \le 200000) — the number of rooms in the labyrinth.

The following n - 1 lines describe the corridors connecting the rooms. Each line contains two integers and v~(1 \le u, v \le n, u \neq v) — the indices of the rooms connected by a corridor.

It is guaranteed that the given corridor system forms a tree.

Output

Print a single integer — the minimum number of friends required to guarantee that the butterfly will be caught.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading