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

enum inf = 1L << 50;
enum mod = 10L^^9 + 7;

void main() {
    int n;
    scan(n);
    auto adj = new int[][](n, 0);
    foreach (i ; 0 .. n-1) {
        int x, y;
        scan(x, y);
        x--, y--;
        adj[x] ~= y;
        adj[y] ~= x;
    }

    auto dp = new long[][](n, 2);
    fillAll(dp, -1);

    long dfs(int v, int p, int col) {
        if (dp[v][col] != -1) {
            return dp[v][col];
        }

        dp[v][col] = 1;

        foreach (u ; adj[v]) {
            if (u == p) continue;
            long t = 0;
            t += dfs(u, v, 0);
            t %= mod;

            if (col == 0) {
                t += dfs(u, v, 1);
                t %= mod;
            }

            dp[v][col] *= t;
            dp[v][col] %= mod;
        }

        return dp[v][col];
    }



    auto ans = dfs(0, -1, 0) + dfs(0, -1, 1);
    ans %= mod;

    debug {
        writefln("%(%s\n%)", dp);
    }

    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}