#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
const int INF=1e9;

ll b[100000],w[100000];
vector<int> e[100000];

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

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int x,y;
        cin>>x>>y;
        --x,--y;
        e[x].push_back(y);
        e[y].push_back(x);
    }
    dfs(0,-1);
    cout<<(b[0]+w[0])%MOD<<endl;
}
