let N = Int(readLine()!)!

var edges = Array(repeating: [Int](), count: N)
for _ in stride(from: 0, to: N - 1, by: 1) {
    let input = readLine()!.split(separator: " ").map{ Int($0)! }
    edges[input[0] - 1].append(input[1] - 1)
    edges[input[1] - 1].append(input[0] - 1)
}

var dp = Array(repeating: [true: Optional<Int>.none, false: Optional<Int>.none], count: N)

let divider = 1_000_000_007

func getNumberOfCombinations(_ rootNodes: [Int], _ canBeColoredBlack: Bool) -> Int {
    guard dp[rootNodes.last!][canBeColoredBlack]! == nil else {
        return dp[rootNodes.last!][canBeColoredBlack]!!
    }

    var numberOfCombinationsWhenBlack = canBeColoredBlack ? 1 : 0
    var numberOfCombinationsWhenWhite = 1

    for i in stride(from: 0, to: edges[rootNodes.last!].count, by: 1) {
        let nextNode = edges[rootNodes.last!][i]
        guard !rootNodes.contains(nextNode) else { continue }
        numberOfCombinationsWhenBlack = numberOfCombinationsWhenBlack * getNumberOfCombinations(rootNodes + [nextNode], false) % divider
        numberOfCombinationsWhenWhite = numberOfCombinationsWhenWhite * getNumberOfCombinations(rootNodes + [nextNode], true) % divider
    }

    dp[rootNodes.last!][canBeColoredBlack] = (numberOfCombinationsWhenBlack + numberOfCombinationsWhenWhite) % divider
    return dp[rootNodes.last!][canBeColoredBlack]!!
}

print(getNumberOfCombinations([0], true))
