N = int(input()) D = [0] * N c = 0 for i in range(N-1): a, b = map(int, input().split()) D[a-1] += 1 D[b-1] += 1 for d in D: c += max(d-2,0) print(c)