eolymp
bolt
Try our new interface for solving problems
Problems

Micro and Tree

Micro and Tree

Micro is having a tree which is having n nodes. Micro can perform some operations on the tree. In one operation he can select a node and remove it along with the entire subtree rooted at it, from its current position and attach it as child of some other node. He defines a functions f(x) on the tree, as the minimum number of operations needed to be done to make a straight chain of nodes out of the given tree, when the tree is rooted at node x. Now Micro wants to find out the minimum of all the f(i) where 1in.

Input

First line consists of a single integer denoting n (1n16). Following n1 lines consists of two space separated integers x and y (1x, yn) denoting there is an edge between nodes x and y.

Output

Print the required answer.

Time limit 1 second
Memory limit 122.17 MiB
Input example #1
5
1 2
1 3
2 4
2 5
Output example #1
1