N = int(input()) E = [input().split(' ') for i in range(N - 1)] d = {} for e in E: d[e[0]] = d[e[0]] + 1 if e[0] in d else 1 d[e[1]] = d[e[1]] + 1 if e[1] in d else 1 print(sum([max(d[x] -2 , 0) for x in d.keys()]))