#P1863I. Redundant Routes
Redundant Routes
No submission language available for this problem.
Description
You are given a tree with vertices labeled . The length of a simple path in the tree is the number of vertices in it.
You are to select a set of simple paths of length at least each, but you cannot simultaneously select two distinct paths contained one in another. Find the largest possible size of such a set.
Formally, a set of vertices is called a route if it contains at least two vertices and coincides with the set of vertices of a simple path in the tree. A collection of distinct routes is called a timetable. A route in a timetable is called redundant if there is a different route such that . A timetable is called efficient if it contains no redundant routes. Find the largest possible number of routes in an efficient timetable.
The first line contains a single integer ().
The -th of the following lines contains two integers and (, ) — the numbers of vertices connected by the -th edge.
It is guaranteed that the given edges form a tree.
Print a single integer — the answer to the problem.
Input
The first line contains a single integer ().
The -th of the following lines contains two integers and (, ) — the numbers of vertices connected by the -th edge.
It is guaranteed that the given edges form a tree.
Output
Print a single integer — the answer to the problem.
Note
In the first example, possible efficient timetables are and .
In the second example, we can choose .