import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) input = sys.stdin.readline #n = int(input()) # #s = input() n = int(input()) edge = [[] for i in range(n)] for i in range(n-1): u,v = map(int,input().split()) u-=1 v-=1 edge[u].append(v) edge[v].append(u) color = [0 for i in range(n)] start = 0 d = collections.deque() dist = [10**18 for i in range(n)] d.append(start) dist[start] = 0 while d: now = d.popleft() for i in edge[now]: if dist[i] > dist[now] + 1: color[i] = color[now] ^ 1 dist[i] = dist[now] + 1 d.append(i) x = sum(1 if color[i] == 0 else 0 for i in range(n)) y = sum(1 if color[i] == 1 else 0 for i in range(n)) print(min(x,y))