N = gets.to_i E = Hash.new { |h, k| h[k] = [] } (N - 1).times do u, v = gets.split.map(&:to_i) E[u] << v E[v] << u end ans = 0 f =->(v, parent = -1) { ans += 1 if [E[v].size - 2, 0].max > 0 E[v].each do |u| next if u == parent f[u, v] end } root = [*1..N].index { |u| E[u].size == 1 } f[root] puts ans