#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1000000007;
int N;
vector<int> G[100010];
long long b[100010], w[100010];

void dfs(int u, int p) {
    b[u] = 1;
    w[u] = 1;
    for (int v : G[u]) {
        if (v == p) continue;
        dfs(v, u);
        b[u] *= w[v];
        b[u] %= MOD;
        w[u] *= w[v] + b[v];
        w[u] %= MOD; 
    } 
}

int main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int x, y; cin >> x >> y;
        x--, y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    dfs(0, -1);
    int ans = (b[0] + w[0]) % MOD;
    cout << ans << endl;
}