Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
Statistical Charts
Submit Problem
Online Status
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Tour in Wonder Land
Time Limit: 2000MSMemory Limit: 65536K
Total Submissions: 1378Accepted: 412


You must have heard of the literature "Alice's Adventures in Wonderland"! The 3D film "Alice in Wonderland" published by Disney Company becomes the most popular film in 2010! Today, Alice starts her new adventure in Wonderland again!

In Wonderland, there are n cities, numbered from 1 to n. The capital is city 1. Cities are connected by bi-directional roads. The road system is constructed so that from every city, there is exactly one way to reach any other.

Alice hopes that she could make a tour in which she visits each city exactly once then return to the capital. Furthermore, she doesn't want to traverse any road more than once. Obviously, it is impossible to make such tour with current road system.

However, in Wonderland, we can use magic spells! The Cheshire Cat, with his magic power, plans to construct more roads to make Alice's dream come true. Sadly, if he used too many magic spells, he would be weaken. "What is the minimum number of roads I have to construct?" - The poor cat wonders. Could you help him answer this question?


The first line of input contains the number n --- the number of cities in Wonderland (3 ≤ n ≤ 100 000). The following n-1 lines describe the roads. Each road is represented by two integers --- the indexes of two cities it connects.


The minimum number of roads to construct.

Sample Input

1 2
2 3
2 4
1 5

Sample Output



In this example, we can construct 2 roads: 3-4 and 4-5, then Alice will be able to take a tour 1-2-3-4-5-1


[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator