// Slower C++ solution:
#include<cstdio>

#include<cstdlib>

#include<algorithm>

#include<iostream>

#include<queue>

#include<vector>

#include <bitset>

#include <cmath>

#include <limits>

#include <iostream>

#include<map>

#include<tuple>

using namespace std;

#define INF 1LL<<62

#define MAX 1100000

#define MOD 1000000007

typedef long long ll;

typedef pair<ll,ll> P;

typedef pair<pair<int,int>,int> p;

typedef pair< pair<int,int>, int> p; 

#define bit(n,k) ((n>>k)&1) /*nのk bit目*/

#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

//__builtin_popcount(S)



//https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035



vector<int> V[110000];

ll dp[110000][2];

bool flag[110000];



void f(int x){

    if(flag[x]) return;

    flag[x]=true;

    dp[x][0]=1;

    dp[x][1]=1;

    for(int i=0;i<(int)V[x].size();i++){

        int next=V[x][i];

        if(flag[next]) continue;

        f(next);

        dp[x][0]=(dp[x][0]*(dp[next][0]+dp[next][1])%MOD)%MOD;

        dp[x][1]=(dp[x][1]*dp[next][0])%MOD;

    }

}



int main(){

    for(int i=0;i<110000;i++) flag[i]=false;

    int N;

    cin>>N;

    for(int i=0;i<N-1;i++){

        int x,y; cin>>x>>y;

        V[x].push_back(y);

        V[y].push_back(x);

    }

    f(1);

    /*for(int i=0;i<=N;i++){

        cout<<i<<endl;

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

    }*/

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

}




// Faster C++ solution for the same problem (measured speedup: 3.8368853310299014x):
#pragma GCC optimize("Ofast")

#include <cstdio>

#include <cstdlib>

#include <string>

#include <algorithm>

#include <iostream>

#include <queue>

#include <vector>

#include <bitset>

#include <cmath>

#include <limits>

#include <iostream>

#include <map>

#include <set>

#include <tuple>

#include <iomanip>

#include <functional>

#include <complex>



using namespace std;



typedef long long ll;

typedef pair<int,int> pii;

typedef pair<int,ll> pil;

typedef pair<ll,int> pli;

typedef pair<ll,ll> pll;



template<class T,class U>constexpr bool chmin(T&a,const U b){if(a<=b)return false;a=b;return true;}

template<class T,class U>constexpr bool chmax(T&a,const U b){if(a>=b)return false;a=b;return true;}

#define bit(n,k) ( (n>>k)&1 )



//デバッグ

template<class T>

void Vout(vector<T> &V){

    cout<<"\nstart\n";

    const int sz=V.size();

    for(int i=0;i<sz;i++){

        cout<<i<<" "<<V[i]<<'\n';

    }

    cout<<"end\n"<<endl;

}



template<class T>

void VPout(vector<T> &V){

    cout<<"\nstart\n";

    const int sz=V.size();

    for(int i=0;i<sz;i++){

        cout<<i<<" "<<V[i].first<<" "<<V[i].second<<'\n';

    }

    cout<<"end\n"<<endl;

}





//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





constexpr int MAX=1<<30;

constexpr ll INF=1LL<<62;

constexpr int MOD=1e9+7;

int dx[]={1,-1,0,0},dy[]={0,0,-1,1};



//__builtin_popcount(S);

//#define int ll

//vector<vector<int>> data(3, vector<int>(4));

//vector.resize(a,vector<int>(b,-1));

//vector<vector<vector<要素の型>>> 変数名(要素数1, vector<vector<要素の型>>(要素数2, vector<要素の型>(要素数3, 初期値)));



using Graph=vector<vector<int>>;



struct ModInt{

    ll a;

    constexpr ModInt() :a(0){}

    constexpr ModInt(ll x) :a((x>=0)?(x%MOD):(x%MOD+MOD) ) {}



    constexpr ModInt operator+(const ModInt rhs)const noexcept{

        return ModInt(*this)+=rhs;

    }

    constexpr ModInt operator-(const ModInt rhs)const noexcept{

        return ModInt(*this)-=rhs;

    }

    constexpr ModInt operator*(const ModInt rhs)const noexcept{

        return ModInt(*this)*=rhs;

    }

    constexpr ModInt operator/(const ModInt rhs)const noexcept{

        return ModInt(*this)/=rhs;

    }

    constexpr ModInt operator+(const ll rhs) const noexcept{

        return ModInt(*this)+=rhs;

    }

    constexpr ModInt operator-(const ll rhs)const noexcept{

        return ModInt(*this)-=rhs;

    }

    constexpr ModInt operator*(const ll rhs)const noexcept{

        return ModInt(*this)*=rhs;

    }

    constexpr ModInt operator/(const ll rhs)const noexcept{

        return ModInt(*this)/=rhs;

    }



    constexpr ModInt &operator+=(const ModInt rhs)noexcept{

        a+=rhs.a;

        if(a>=MOD) a-=MOD;

        return *this;

    }

    constexpr ModInt &operator-=(const ModInt rhs)noexcept{

        a-=rhs.a;

        if(a<0) a+=MOD;

        return *this;

    }

    constexpr ModInt &operator*=(const ModInt rhs)noexcept{

        a=(a*rhs.a)%MOD;

        return *this;

    }

    constexpr ModInt &operator/=(ModInt rhs)noexcept{

        a=(a*rhs.inverse().a)%MOD;

        return *this;

    }

    constexpr ModInt &operator+=(const ll rhs)noexcept{

        a+=rhs;

        if(a>=MOD) a-=MOD;

        return *this;

    }

    constexpr ModInt &operator-=(const ll rhs)noexcept{

        a-=rhs;

        if(a<0) a+=MOD;

        return *this;

    }

    constexpr ModInt &operator*=(const ll rhs)noexcept{

        a=(a*rhs)%MOD;

        return *this;

    }

    constexpr ModInt &operator/=(ll rhs)noexcept{

        a=(a*ModInt(rhs).inverse().a)%MOD;

        return *this;

    }



    constexpr ModInt operator=(ll x)noexcept{

        x%=MOD;

        if(x<0) x+=MOD;

        a=x;

        return *this;

    }



    constexpr bool operator==(const ModInt p)const noexcept{

        return a==p.a;

    }



    constexpr bool operator!=(const ModInt p)const noexcept{

        return a!=p.a;

    }



    constexpr ModInt pow(ll N) const noexcept{

        ModInt ans(1LL),p(a);

        while(N>0){

            if(bit(N,0)){

                ans*=p;

            }

            p*=p;

            N>>=1;

        }

        return ans;

    }

    constexpr ModInt inverse() const noexcept{

        return pow(MOD-2);

    }



};

inline constexpr ModInt operator+(const ll &a,const ModInt &b)noexcept{

    return ModInt(a)+=b;

}

inline constexpr ModInt operator-(const ll &a,const ModInt &b)noexcept{

    return ModInt(a)-=b;

}

inline constexpr ModInt operator*(const ll &a,const ModInt &b)noexcept{

    return ModInt(a)*=b;

}

inline constexpr ModInt operator/(const ll &a,const ModInt &b)noexcept{

    return ModInt(a)/=b;

}





constexpr ModInt Mr(ll p){

    p%=MOD;

    if(p<0) p+=MOD;

    return ModInt(p);

}





ModInt dp[110000][2];

Graph g;



void dfs(int idx,int pre){

    dp[idx][0]=1;

    dp[idx][1]=1;

    for(int next:g[idx]){

        if(next==pre) continue;

        dfs(next,idx);

        dp[idx][0]*=(dp[next][1]+dp[next][0]);

        dp[idx][1]*=dp[next][0];

    }

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr); 

    cout<<fixed<<setprecision(10);





    int n;

    cin>>n;

    g.resize(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);

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

}