N = gets.to_i D = Array.new(N + 1, 0) (1 ... N).each do a,b = gets.split.map(&:to_i) D[a] += 1 D[b] += 1 end puts D.count(1) - 2