let N = Int(readLine()!)!
var graph: [[Int]] = .init(repeating: [], count: N + 1)

for _ in 0..<N-1 {
  let input = readLine()!.split(separator: " ").map { Int($0)! }
  let x = input[0]
  let y = input[1]
  graph[x].append(y)
  graph[y].append(x)
}
let mod = 1000000007
var dp: [(white: Int, black: Int)] = .init(repeating: (-1, -1), count: N+1)

print(dfs(1, graph, &dp, mod))

func dfs(_ i: Int, _ graph: [[Int]],
         _ dp: inout [(white: Int, black: Int)], _ mod: Int) -> Int {
  if dp[i] != (-1, -1) {
    return (dp[i].white + dp[i].black) % mod
  }
  dp[i] = (1, 1)
  for nei in graph[i] {
    if dp[nei] != (-1, -1) {
      continue
    }
    _ = dfs(nei, graph, &dp, mod)
    dp[i].white = dp[i].white * (dp[nei].white + dp[nei].black) % mod
    dp[i].black = dp[i].black * dp[nei].white % mod
  }
  return (dp[i].black + dp[i].white) % mod
}

