N = int(input()) E = [[] for i in range(N)] for i in range(N-1): u,v = map(int,input().split()) E[u-1].append(v-1) E[v-1].append(u-1) Q = [0] C = [-1] * N L = [[],[]] C[0] = 0 L[0].append(0) for p in Q: for e in E[p]: if C[e] == -1: Q.append(e) C[e] = 1 - C[p] L[C[e]].append(e) print(min(len(L[0]),len(L[1])))