from sys import setrecursionlimit setrecursionlimit(10**6) def dfs1(pos): ret = 1 for nxt in G1[pos]: ret += dfs1(nxt) Dist[pos] = ret return ret N = int(input()) G1 = [[] for _ in range(N)] G2 = [-1] * N for _ in range(N-1): x,y = map(int,input().split()) x -= 1 y -= 1 G1[x].append(y) G2[y] = x Dist = [-1] * N dfs1(0) for i in range(N): Dist[i] = [Dist[i], i] Dist.sort(reverse=True) Cnt = [0] * N Flg = [1] * N for i in range(1,N): x = Dist[i][1] pos = G2[x] Queue = [] while pos != -1: Queue.append(pos) if Cnt[pos] < 2: Cnt[pos] += 1 break pos = G2[pos] if pos == -1: for k in Queue: G2[k] = -1 Flg[x] = 0 print(sum(Flg))