local n = io.read("*n")
local edge = {}
for i = 1, n do
  edge[i] = {}
end
for i = 1, n - 1 do
  local a, b = io.read("*n", "*n")
  a = a + 1
  b = b + 1
  table.insert(edge[a], b)
  table.insert(edge[b], a)
end

local function getend(start)
  local len = {}
  for i = 1, n do
    len[i] = -1
  end
  len[start] = 0
  local mlenidx = 1
  local tasks = {start}
  while 0 < #tasks do
    local src = tasks[#tasks]
    table.remove(tasks)
    for i = 1, #edge[src] do
      local dst = edge[src][i]
      if len[dst] < 0 then
        len[dst] = len[src] + 1
        if len[mlenidx] < len[dst] then
          mlenidx = dst
        end
        table.insert(tasks, dst)
      end
    end
  end
  return mlenidx
end
local root = getend(1)

local parent = {}
local asked = {}
local asked_child_cnt = {}
local tasks = {}
local required = {}
for i = 1, n do
  required[i] = false
  parent[i] = 0
  asked[i] = false
  asked_child_cnt[i] = 0
  if #edge[i] == 1 then
    if i ~= root then
      table.insert(tasks, i)
    end
  end
end
local done = 0
while done < #tasks do
  done = done + 1
  local child = tasks[done]
  asked[child] = true
  if child == root then break end
  if 3 <= #edge[child] then
    required[child] = true
  end
  for i = 1, #edge[child] do
    local pcand = edge[child][i]
    if not asked[pcand] then
      parent[child] = pcand
      asked_child_cnt[pcand] = asked_child_cnt[pcand] + 1
      if asked_child_cnt[pcand] == #edge[pcand] - 1 then
        table.insert(tasks, pcand)
      end
    end
  end
end
-- for i = 1, n do
--   asked[i] = false
-- end
-- asked[root] = true
tasks[1] = edge[root][1]
tasknum = 1
done = 0
local ret = 1
while done < tasknum do
  done = done + 1
  local p = tasks[done]
  local required_cnt = #edge[p] - 2
  for i = 1, #edge[p] do
    local c = edge[p][i]
    if c ~= parent[p] then
      if required[c] then
        required_cnt = required_cnt - 1
      end
      tasknum = tasknum + 1
      tasks[tasknum] = c
    end
  end
  if 0 < required_cnt then
    ret = ret + required_cnt
  end
end
print(ret)
