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