//k_tourist
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 500005
#define non __builtin_popcount
#define ml map<ll, ll> 
#define uml unordered_map<ll, ll>
#define ms map<string , ll> 
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define pl pair<ll, ll>
#define vl vector<ll>
#define vll vector<pl>
#define tpl pair<ll, pl>
#define vlll vector<tpl>
#define vs vector<string>
#define pb push_back
#define mk make_pair
#define M_PI 3.14159265358979323846
#define endl '\n'
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define inf ((ll)1e18 + 1)
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define pow powr
#define sp(a) setprecision(a)
#define rep(i,a,b)  for (i=(a);i<(b);i++)
#define nrep(i,a,b) for (i=(a);i>(b);i--)
using namespace std;
using namespace __gnu_pbds;  

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set;
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void flag(ll fl){

	if(fl)
	cout<<"NO";
	else
	cout<<"YES";
}


vl gr[mx];
ll vis[mx], lev[mx];

void dfs(ll nd, ll par){

    vis[nd]= 1;

    for(ll ch: gr[nd]){


        
        if(!vis[ch])
        dfs(ch, nd);



    }
}

void bfs(ll nd){

    lev[nd]= 0;

    queue<ll> q;

    q.push(nd);

    while(!q.empty()){

        nd= q.front();
        vis[nd] = 1;

        q.pop();

        for(ll ch : gr[nd]){

            if(!vis[ch]){

                lev[ch]= lev[nd] +1;
                q.push(ch);





            }
        }
    }

}

void graph(ll n, ll m){

    ll i, j;

    rep(i, 1, n+1)
    {
        vis[i]= 0;
        gr[i].clear();
    }

    while(m--){

        ll x, y;
        cin>>x>>y;
        gr[x].pb(y);
        gr[y].pb(x);
    }
}

ll dp[mx][2];

ll ind(ll nd, ll par, ll cl){

    if(dp[nd][cl] != -1)
    return dp[nd][cl];

    // if((gr[nd].size() == 1 && gr[nd][0] == par ) || !gr[nd].size())
    // return 1;

    ll ans= 1;
    if(!cl)
    {

        for(ll kk: gr[nd])
        {
            if(kk != par)
            {
                // ans= (ans + ind(kk, nd, 0) + ind(kk, nd, 1))%mod;

                ans= (ans * (ind(kk, nd, 0) + ind(kk, nd, 1)))%mod;
            }
        }
    }
    else
    {
        for(ll kk : gr[nd]){

            if(kk != par)
            {
                // ans= (ans + ind(kk, nd, 1))%mod;
                ans= (ans * ind(kk, nd, 0))%mod;
            }
        }
    }

    return dp[nd][cl]= ans;
    
}

void bta_de_yarr(){

	ll n, i, j, fl=0, ans, m;

    cin>>n;

    graph(n, n-1);

    rep(i, 0, n+1)
    dp[i][0]= dp[i][1]= -1;

    ans= (ind(1, 1, 0) + ind(1, 1, 1)) %mod;
	
	cout<<ans;
	// flag(fl);
	cout<<endl;
}

int main(){
    fst

	// freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	ll t;
    t= 1;
	//cin>>t;
    while(t--){
        bta_de_yarr();
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 29056