# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(input()) adj = [[] for _ in range(N)] for _ in range(N-1): a, b = map(lambda x: int(x)-1, input().split()) adj[a].append(b) adj[b].append(a) ans = 0 for l in adj: ans += max(0, len(l)-2) print(ans)