import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto G = new int[][](N);
    foreach (i; 0..N-1) {
        auto s = readln.split.map!(to!int);
        G[s[0]-1] ~= s[1]-1;
        G[s[1]-1] ~= s[0]-1;
    }

    auto mem = new long[][](N, 2);
    auto used = new bool[][](N, 2);

    long dfs(int n, int p, bool b) {
        if (used[n][b]) return mem[n][b];
        long bb = 1;
        long ww = 1;
        long retb = 1;
        long retw = 1;
        if (b) retb = 0;
        foreach (m; G[n]) {
            if (m == p) continue;
            retw *= ww * dfs(m, n, false) % MOD;
            retb *= bb * dfs(m, n, true) % MOD;
            retw %= MOD;
            retb %= MOD;
        }
        used[n][b] = true;
        mem[n][b] = (retw + retb) % MOD;
        return mem[n][b];
    }

    dfs(0, -1, 0).writeln;
}
