题目描述
Problem Description
As we all know, a chain is composed of interconnected rings. Typically, all rings have the same shape and size. Bob is an apprentice blacksmith, and he is making his first iridium chain. He follows the traditional rules for chain making, which state:
- If there is no chain, make a ring, which will become part of your chain.
- If there is a chain, make a ring and connect it to another ring in your existing chain.
Bob made the first ring. Then, each time he made another ring, he connected it to another ring in the chain, as the rules instructed.
When he finished, he realized that the object he created did not resemble a regular chain at all. To straighten the chain, he repeatedly lifted two rings that might be the ends of the chain and tried to pull them apart as much as possible. However, at different places, more "chains" hung down from the straightened part.
Clearly, Bob's work is not yet done, and he decided to call the object he created an unfinished chain. After more thought, Bob concluded that he must carefully disconnect some rings and reconnect them to the rest of the unfinished chain to achieve the straight chain he wants to make. In a straight chain, each ring is connected to at most two other rings, and the chain cannot be separated into more parts without breaking a ring.
Bob is now more cautious and will make progress in simple steps. In one step, he will select a ring A connected to another ring B in the unfinished chain. Then, he will disconnect A from B, separate A, and reconnect A to another ring C in the unfinished chain. If the rings initially connected to A are not B, Bob will keep them connected to A throughout the step.
What is the minimum number of steps Bob needs to perform to obtain the straight chain?
Input Format
The first line contains an integer $N\ (1\le N\le 3\times 10^5)$, representing the number of rings in the unfinished chain. All rings are numbered from $1$ to $N$.
The next $N-1$ lines each contain two integers, representing the numbers of two connected rings in the unfinished chain, given in any order. The unfinished chain is guaranteed to be a single connected component (i.e., there is a path between any two rings).
Output Format
Output a single integer, representing the minimum number of steps required to transform Bob's unfinished chain into a straight chain.
Sample Input and Output
Sample Input #1
5
4 3
1 2
4 5
3 2
Sample Output #1
0
Sample Input #2
6
1 3
3 2
3 4
4 5
4 6
Sample Output #2
2
Sample Input #3
7
1 2
2 3
3 4
4 5
3 6
6 7
Sample Output #3
1
Notes
Sample Explanation

输入格式
见题面 Input 部分
输出格式
见题面 Output 部分