#C3752. Minimum Roads to Block

    ID: 47214 Type: Default 1000ms 256MiB

Minimum Roads to Block

Minimum Roads to Block

You are given a tree of n towns (nodes) connected by exactly n-1 roads (edges). In a tree, any single road removal will disconnect the graph into two separate parts. Your task is to determine the minimum number of roads that must be blocked in order to disconnect the kingdom.

Note: It is guaranteed that the input graph is a tree and n ≥ 2. Therefore, the answer is always 1.

For example, consider the following test case:

Input:
4
1 2
1 3
2 4

Output: 1

</p>

inputFormat

The input is read from standard input and has the following format:

  • The first line contains an integer n (n ≥ 2), the number of towns.
  • The following n-1 lines each contain two integers u and v, indicating a road connecting town u with town v.

outputFormat

Output a single integer on a new line to standard output: the minimum number of roads to block in order to disconnect the kingdom.

## sample
4
1 2
1 3
2 4
1