N = int(input()) T = [[] for i in range(N)] for i in range(N - 1): u, v = map(int, input().split()) u, v = u - 1, v - 1 T[u].append(v) T[v].append(u) ans = 0 for i, tos in enumerate(T): if len(tos) == 1: continue ans += len(tos) - 2 print(ans)