N = int(input()) lsg = [[] for i in range(N)] lsj = [0]*(N) for i in range(N-1): a,b = map(int,input().split()) a -= 1 b -= 1 lsg[a].append(b) lsg[b].append(a) lsj[a] += 1 lsj[b] += 1 cnt = 0 for i in range(N): cnt += max(0,lsj[i]-2) print(cnt)