from collections import defaultdict
d = defaultdict(list)
n = int(input())
for i in range(n-1):
    a,b = map(int,input().split())
    d[a].append(b)
    d[b].append(a)
#print(d)
visited = defaultdict(bool)
visited[1]=True
lenth = 0
stack = [1]
while stack:
    next_layer = []
    while stack: #explore current layer stack
        node = stack.pop()
        for nex in d[node]:#add all next layer nodes of current node to next_layer
            if not visited[nex]:
                next_layer.append(nex)
                visited[nex]=True
    stack = next_layer #set current layer as next_layer
    lenth +=1 #layer +1 
print(2*(n-1)-lenth+1) # lenth add 1 when next_layer is empty in last loop