N = int( input()) E = [ [] for _ in range(N)] for _ in range(N-1): a, b = map( int, input().split()) a, b = a-1, b-1 E[a].append(b) E[b].append(a) ans = 0 for i in range(N): if len(E[i]) == 1: continue ans += len(E[i])-2 print(ans)