CF1521D Nastia Plays with a Tree
Description
Nastia has an unweighted tree with $ n $ vertices and wants to play with it!
The girl will perform the following operation with her tree, as long as she needs:
1. Remove any existing edge.
2. Add an edge between any pair of vertices.
What is the minimum number of operations Nastia needs to get a bamboo from a tree? A bamboo is a tree in which no node has a degree greater than $ 2 $ .
Input Format
N/A
Output Format
N/A
Explanation/Hint
Note the graph can be unconnected after a certain operation.
Consider the first test case of the example:
 The red edges are removed, and the green ones are added.