#P982C. Cut 'em all!
Cut 'em all!
No submission language available for this problem.
Description
You're given a tree with vertices.
Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size.
The first line contains an integer () denoting the size of the tree.
The next lines contain two integers , () each, describing the vertices connected by the -th edge.
It's guaranteed that the given edges form a tree.
Output a single integer — the maximum number of edges that can be removed to leave all connected components with even size, or if it is impossible to remove edges in order to satisfy this property.
Input
The first line contains an integer () denoting the size of the tree.
The next lines contain two integers , () each, describing the vertices connected by the -th edge.
It's guaranteed that the given edges form a tree.
Output
Output a single integer — the maximum number of edges that can be removed to leave all connected components with even size, or if it is impossible to remove edges in order to satisfy this property.
Samples
Note
In the first example you can remove the edge between vertices and . The graph after that will have two connected components with two vertices in each.
In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is .