import sys input = sys.stdin.readline N=int(input()) E=[[] for i in range(N)] for i in range(N-1): x,y=map(int,input().split()) x-=1 y-=1 E[x].append(y) E[y].append(x) N+=1 # ROOTの親の点を一つ余計に見るため、総ノード数を一つ増やしておく ROOT=0 QUE=[ROOT] Parent=[-1]*(N+1) Parent[ROOT]=N # ROOTの親を定めておく. TOP_SORT=[] # トポロジカルソート while QUE: # トポロジカルソートと同時に親を見つける x=QUE.pop() TOP_SORT.append(x) for to in E[x]: if Parent[to]==-1: Parent[to]=x QUE.append(to) USE=[0]*(N+2) ANS=0 for x in TOP_SORT[::-1]: if USE[x]==0: USE[Parent[x]]=2 elif USE[x]==2: ANS+=1 print(ANS)