import sys input = sys.stdin.readline N=int(input()) E=[[] for i in range(N)] for i in range(N-1): a,b=list(map(int,input().split())) a-=1 b-=1 E[a].append(b) E[b].append(a) ROOT=0 QUE=[ROOT] Parent=[-1]*N Parent[ROOT]=N # ROOTの親を定めておく. Child=[[] for i in range(N)] TOP_SORT=[] # トポロジカルソート while QUE: # トポロジカルソートと同時に親を見つける x=QUE.pop() TOP_SORT.append(x) for to in E[x]: if Parent[to]==-1: Parent[to]=x Child[x].append(to) QUE.append(to) DP1=[1<<31]*N # 部分木全部を黒くするコスト DP2=[1<<31]*N # 親が黒のとき、部分木全部を黒くするコスト for x in TOP_SORT[::-1]: if Child[x]==[]: DP1[x]=1 DP2[x]=0 continue score=0 for c in Child[x]: score+=DP2[c] L=[] for c in Child[x]: L.append(DP1[c]-DP2[c]) L.sort() k=len(E[x])//2+1 #print(x,k,L) if len(L)>=k: score2=0 for i in range(len(L)): if i=k: for i in range(len(L)): if i