# 次数が3のところを切っていけばいい # 閉路はない、木だから # 切るときは、お互いに次数が3以上のところを優先する N = int(input()) edges = [[] for i in range(N+1)] degree = [0]*(N+1) for i in range(N-1): a, b = map(int, input().split()) edges[a].append(b) edges[b].append(a) degree[a] += 1 degree[b] += 1 from collections import deque que = deque() for i in range(1, N+1): if degree[i] > 2: que.append(i) count = 0 while que: current = que.popleft() if degree[current] > 2: for nxt in edges[current]: if degree[nxt] > 2: edges[current].remove(nxt) edges[nxt].remove(current) degree[current] -= 1 degree[nxt] -= 1 count += 1 if degree[current] <= 2: break if degree[current] > 2: for nxt in edges[current]: edges[current].remove(nxt) edges[nxt].remove(current) degree[current] -= 1 degree[nxt] -= 1 count += 1 if degree[current] <= 2: break #print(count, edges) print(count)