import sys sys.setrecursionlimit(100000000) N = int(input()) e = [ [] for i in range(N)] for i in range(N-1): a,b = map(int,input().split()) a-=1 b-=1 e[a].append(b) e[b].append(a) #最も次数の小さい頂点から深さ優先探索。葉の枚数-1が答え col = [ -1 for i in range(N)] ans = 0 def dfs(n,c,pre): global ans if pre != -1 and len(e[n]) == 1 and e[n][0] == pre: ans += 1 col[n] = c for node in e[n]: if col[node] == -1: dfs(node,c+1,n) k = -1 m = 10**10 for i in range(N): if len(e[i]) < m: k = i m = len(e[i]) dfs(k,0,-1) print(ans-1)