// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define i_7 (ll)(1E9+7)

#define i_5 (ll)(1E9+5)

ll mod(ll a){

    ll c=a%i_7;

    if(c>=0)return c;

    else return c+i_7;

}

typedef pair<int,int> i_i;

typedef pair<ll,ll> l_l;

ll inf=(ll)1E12;

#define rep(i,l,r) for(ll i=l;i<=r;i++)

#define pb push_back

ll max(ll a,ll b){if(a<b)return b;else return a;}

ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);

void Min(ll * pos,ll val){*pos=min(*pos,val);}

void Add(ll * pos,ll val){*pos=mod(*pos+val);}

const long double EPS=1E-8;

////////////////////////////////////////



#define N 100005

ll n;

vector<ll>e[N];

ll p[N];

vector<ll>chi[N];

ll dp[N][2];

bool used[N];



void dfs(ll c){

    ll answ=1,ansb=1;

    for(auto x:chi[c]){

        dfs(x);

        answ=mod(answ*mod(dp[x][0]+dp[x][1]));

        ansb=mod(ansb*dp[x][0]);

    }

    dp[c][0]=answ;dp[c][1]=ansb;

}



int main(){

    cin>>n;

    rep(i,0,n-2){

        ll x,y;cin>>x>>y;

        x--;y--;

        e[x].pb(y);e[y].pb(x);

    }

    rep(i,0,n-1)p[i]=-1;p[0]=-2;

    queue<ll>q;q.push(0);

    while(!q.empty()){

        ll t=q.front();q.pop();

        for(auto x:e[t]){

            if(p[x]!=-1)continue;

            p[x]=t;

            chi[t].pb(x);

            q.push(x);

        }

    }

    /*rep(i,0,n-1){

        cout<<i<<":";

        for(auto x:chi[i])cout<<x<<" ";cout<<endl;

    }*/

    

    dfs(0);

    /*rep(i,0,n-1){

        cout<<dp[i][0]<<" "<<dp[i][1]<<endl;

    }*/



    cout<<mod(dp[0][0]+dp[0][1])<<endl;

    

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

//#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

//#include "boost/multiprecision/cpp_int.hpp"

//typedef boost::multiprecision::cpp_int LL;

typedef long double dd;

#define i_7 (ll)(1E9+7)

//#define i_7 998244353

#define i_5 i_7-2



ll mod(ll a){

    ll c=a%i_7;

    if(c>=0)return c;

    return c+i_7;

}

typedef pair<ll,ll> l_l;

typedef pair<dd,dd> d_d;

ll inf=(ll)1E16;

#define rep(i,l,r) for(ll i=l;i<=r;i++)

#define pb push_back

ll max(ll a,ll b){if(a<b)return b;else return a;}

ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);

void Min(ll &pos,ll val){pos=min(pos,val);}

void Add(ll &pos,ll val){pos=mod(pos+val);}

dd EPS=1E-9;

#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define fi first

#define se second

#define endl "\n"

#define SORT(v) sort(v.begin(),v.end())

#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())

#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())

#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())

//template<class T>void max(T a,T b){if(a<b)return b;else return a;}

//template<class T>void min(T a,T b){if(a>b)return b;else return a;}

//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}

//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}



//////////////////////////



#define N 100005

ll n;

vector<ll>v[N];

ll dp[N][2];



void dfs(ll id,ll par){

    dp[id][0]=1;

    dp[id][1]=1;

    for(auto x:v[id]){

        if(x==par)continue;

        dfs(x,id);

        dp[id][0]=mod(dp[id][0]*(dp[x][0]+dp[x][1]));

        dp[id][1]=mod(dp[id][1]*dp[x][0]);

    }

    

}



int main(){fastio

    cin>>n;

    rep(i,1,n-1){

        ll a,b;cin>>a>>b;

        v[a].pb(b);

        v[b].pb(a);

    }

    dfs(1,-1);

    ll ans=0;rep(i,0,1)Add(ans,dp[1][i]);

    //rep(i,1,n){rep(j,0,1)cout<<dp[i][j]<<" ";cout<<endl;}

    cout<<ans<<endl;

    

    return 0;

}




// Fastest known solution for this problem: