Antennas On Tree

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

We have a tree with NN vertices. The vertices are numbered 00 through N1N - 1, and the ii-th edge (0i<N10 \le i < N - 1) connects vertex a_ia\_i and b_ib\_i. For each pair of vertices uu and vv (0u,v<N0 \le u, v < N), we define the distance d(u,v)d(u, v) as the number of edges on the path uu-vv.

It is expected that one of the vertices will be invaded by aliens from outer space. Snuke wants to immediately identify that vertex when the invasion happens. To do so, he has decided to install an antenna on some vertices.

First, he decides the number of antennas, KK (1KN1 \le K \le N). Then, he chooses KK different vertices, x_0,x˜_1,˜,x˜_K1x\_0,\~x\_1,\~\ldots,\~x\_{K - 1}, on which he installs antenna 0,1,,K10, 1, \ldots, K - 1 respectively. If vertex vv is invaded by aliens, antenna kk (0k<K0 \le k < K) will output the distance d(x_k,v)d(x\_k, v). Based on these KK outputs, Snuke will identify the vertex that is invaded. Thus, in order to identify the invaded vertex no matter which one is invaded, the following condition must hold: for each vertex uu (0u<N0 \le u < N), consider the vector (d(x_0,u),,d(x_K1,u))(d(x\_0, u), \ldots, d(x\_{K - 1}, u)). These NN vectors are distinct.

Find the minumum value of KK, the number of antennas, when the condition is satisfied.

입력

Input is given in the following format:

NN

a_0a\_0 b_0b\_0

a_1a\_1 b_1b\_1

\ldots

a_N2a\_{N - 2} b_N2b\_{N - 2}

출력

Print the minumum value of KK, the number of antennas, when the condition is satisfied.

제한

2N1052 \le N \le 10^5, 0a_i,b_i<N0 \le a\_i, b\_i < N, the given graph is a tree.

힌트

In Sample 1, install an antenna on Vertex 11 and 33. Then, the following five vectors are distinct:

  • (d(1,0),d(3,0))=(1,1)(d(1, 0), d(3, 0)) = (1, 1)
  • (d(1,1),d(3,1))=(0,2)(d(1, 1), d(3, 1)) = (0, 2)
  • (d(1,2),d(3,2))=(2,2)(d(1, 2), d(3, 2)) = (2, 2)
  • (d(1,3),d(3,3))=(2,0)(d(1, 3), d(3, 3)) = (2, 0)
  • (d(1,4),d(3,4))=(3,1)(d(1, 4), d(3, 4)) = (3, 1)

In Sample 2 one of posible solutions is to install an antenna on Vertex 00.

In Sample 3 one of possible solutions is to install an antenna on Vertex 00, 44, 99.