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: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1521D/13d06b5ce6ef542dc457141b641d924a2e34ea5d.png) The red edges are removed, and the green ones are added.