N=int(input()) G=[[] for i in range(N)] for i in range(N-1): a,b=map(int,input().split()) G[a-1].append(b-1) G[b-1].append(a-1) from collections import deque S=deque() dist=[-1]*N dist[0]=0 L=[0] S.append(0) while S: x=S.pop() for y in G[x]: if dist[y]==-1: dist[y]=dist[x]+1 S.append(y) L.append(y) L=L[::-1] dp=[0]*N h=[] for pos in L: for y in G[pos]: if dist[y]2: dp[pos]+=1 h.append(pos) v=[0]*N for i in range(N): v[i]=len(G[i]) used=[False]*N S=deque() for pos in h: S.append(pos) used[pos]=True while S: x=S.pop() for y in G[x]: if used[y]==True: continue v[y]-=2 if v[y]<=0: used[y]=True S.append(y) result=len(h) for i in range(N): if used[i]==False: result+=1 break print(result)