N = gets.to_i
E = Hash.new { |h, k| h[k] = {} }

(N - 1).times do
  x, y = gets.split.map(&:to_i)

  E[x][y] = E[y][x] = true
end

MOD = 10 ** 9 + 7
BLACK = 0
WHITE = 1

def dfs(v, color, parent = -1)
  res = 1

  E[v].each_key do |u|
    next if u == parent

    if color == BLACK
      res = res * dfs(u, WHITE, v) % MOD
    else
      res = res * (dfs(u, BLACK, v) + dfs(u, WHITE, v)) % MOD
    end
  end

  res
end

puts (dfs(1, BLACK) + dfs(1, WHITE)) % MOD
