{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eA network is composed of \u003ci\u003eN\u003c/i\u003e computers connected by \u003ci\u003eN\u003c/i\u003e − 1 communication links such that any two computers can be communicated via a unique route. Two computers are said to be \u003ci\u003eadjacent\u003c/i\u003e if there is a communication link between them. The \u003ci\u003eneighbors\u003c/i\u003e of a computer is the set of computers which are adjacent to it. In order to quickly access and retrieve large amounts of information, we need to select some computers acting as \u003ci\u003eservers\u003c/i\u003e to provide resources to their neighbors. Note that a server can serve all its neighbors. A set of servers in the network forms a \u003ci\u003eperfect service\u003c/i\u003e if every client (non-server) is served by \u003cb\u003eexactly one\u003c/b\u003e server. The problem is to find a minimum number of servers which forms a perfect service, and we call this number \u003ci\u003eperfect service number\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eWe assume that \u003ci\u003eN\u003c/i\u003e (≤ 10000) is a positive integer and these \u003ci\u003eN\u003c/i\u003e computers are numbered from 1 to \u003ci\u003eN\u003c/i\u003e. For example, Figure 1 illustrates a network comprised of six computers, where black nodes represent servers and white nodes represent clients. In Figure 1(a), servers 3 and 5 do not form a perfect service because client 4 is adjacent to both servers 3 and 5 and thus it is served by two servers which contradicts the assumption. Conversely, servers 3 and 4 form a perfect service as shown in Figure 1(b). This set also has the minimum cardinality. Therefore, the perfect service number of this example equals two.\u003c/p\u003e\u003cdiv align\u003d\"center\"\u003e\u003cimg src\u003d\"CDN_BASE_URL/d617182408b30735b731189857cbd245?v\u003d1714608555\"\u003e\u003c/div\u003e\u003cp\u003eYour task is to write a program to compute the perfect service number.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of a number of test cases. The format of each test case is as follows: The first line contains one positive integer, \u003ci\u003eN\u003c/i\u003e, which represents the number of computers in the network. The next \u003ci\u003eN\u003c/i\u003e − 1 lines contain all of the communication links and one line for each link. Each line is represented by two positive integers separated by a single space. Finally, a 0 at the (N + 1)th line indicates the end of the first test case.\u003c/p\u003e\u003cp\u003eThe next test case starts after the previous ending symbol 0. A −1 indicates the end of the whole inputs.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eThe output contains one line for each test case. Each line contains a positive integer, which is\r\u003cbr\u003ethe perfect service number.\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n1 3\r\n2 3\r\n3 4\r\n4 5\r\n4 6\r\n0\r\n2\r\n1 2\r\n-1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}