import collections def solve(): ans=0 n=int(input()) side=[] degree=[0 for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) side.append((a,b)) degree[a-1]+=1 degree[b-1]+=1 c = collections.Counter(degree) if c[1]==2: return 0 ck = sorted(c.keys(),reverse=True) for k in ck: if k > 2: ans+=k-2 #if c[1]>=k-2: # c[1]-=k-2 # c[2]+=k-2 return ans print(solve())