Two Postmen

No attempts yetTime limit1sMemory limit128 MB

Problem

A village has just opened a brand-new post office. It hired two postmen who, every morning, set out from the post office and deliver letters throughout the village. You must plan their routes so that the last letter is delivered as early as possible.

The village has nn houses numbered from 11 to nn. The post office is house 11. The houses are joined by n1n-1 two-way roads, and this road network lets you travel between any two houses (that is, the network forms a tree). Traversing a single road takes a postman 11 minute.

Both postmen start at the post office (house 11), and every house must receive its letter. Each road only needs to be traveled by at least one of the two postmen. A postman does not need to return to the post office after finishing. The time at which the last letter is delivered is the later of the two postmen's finishing times, and the goal is to make this value as small as possible.

Input

The first line contains an integer nn, the number of houses in the village (1n30001 \le n \le 3000).

Each of the next n1n-1 lines describes one road. A line contains two integers aa and bb, meaning there is a road connecting house aa and house bb (1a,bn1 \le a, b \le n).

Output

Print, on a single line, the minimum number of minutes in which the two postmen can deliver all the letters.