local mod = 1000000007
local mfl, mce = math.floor, math.ceil
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y)
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  local x0, y0 = x - x1 * 31623, y - y1 * 31623
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end
local n = io.read("*n")
local edge, edgetask = {}, {}
local asked = {}
local white, black = {}, {}
for i = 1, n do
  edge[i] = {}
  edgetask[i] = 0
  asked[i] = false
  white[i] = 0
  black[i] = 0
end
for i = 1, n - 1 do
  local p, q = io.read("*n", "*n")
  edge[p][q], edge[q][p] = true, true
  edgetask[p] = edgetask[p] + 1
  edgetask[q] = edgetask[q] + 1
end
local tasks = {1}
for i = 2, n do
  if edgetask[i] == 1 then
    table.insert(tasks, i)
    black[i] = 1
    white[i] = 1
  end
end
while 0 < #tasks do
  local src = tasks[#tasks]
  table.remove(tasks)
  asked[src] = true
  local all, whites = 1, 1
  local bs, ws = {}, {}
  for dst, _u in pairs(edge[src]) do
    if asked[dst] then
      -- child
      table.insert(bs, black[dst])
      table.insert(ws, white[dst])
    else
      -- parent
      edgetask[dst] = edgetask[dst] - 1
      if edgetask[dst] == 1 and dst ~= 1 then
        table.insert(tasks, dst)
      end
    end
  end
  local w, b = 1, 1
  for i = 1, #bs do
    w = bmul(w, badd(bs[i], ws[i]))
    b = bmul(b, ws[i])
  end
  white[src] = w
  black[src] = b
end
print(badd(black[1], white[1]))
