// Slower C++ solution:
#include <bits/stdc++.h>     



//#pragma GCC optimize("Ofast")

//#pragma comment(linker, "/stack:200000000")

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4"



#define mp make_pair

#define pb push_back

#define f first

#define s second

#define ll long long

#define int ll

#define forn(i, a, b) for(int i = (a); i <= (b); ++i)

#define forev(i, b, a) for(int i = (b); i >= (a); --i)

#define VAR(v, i) __typeof( i) v=(i)

#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)

#define all(x) (x).begin(), (x).end()

#define sz(x) ((int)(x).size())

#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);

 

using namespace std;

 

const int maxn = (int)1e5+100;

const int mod = (int)1e9 + 7;

 

#define inf mod

 

typedef long double ld;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

typedef vector<int> vi;   

typedef vector<ll> Vll;               

typedef vector<pair<int, int> > vpii;

typedef vector<pair<ll, ll> > vpll;



int n, dp[maxn][2];

vi g[maxn];



void dfs(int v, int p = 0){

  dp[v][0]=dp[v][1]=1;

  for(auto to:g[v])

    if(to!=p){

      dfs(to,v);

      dp[v][0]=dp[v][0]*((dp[to][0]+dp[to][1])%mod)%mod;

      dp[v][1]=dp[v][1]*dp[to][0]%mod;

    }

}

main () {

  cin>>n;

  forn(i,1,n-1){

    int u, v;

    cin>>u>>v;

    g[u].pb(v);

    g[v].pb(u);

  }

  dfs(1);

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

}

// Faster C++ solution for the same problem (measured speedup: 1.9325850394530575x):
#include <bits/stdc++.h>



using namespace std;



// Header files, namespaces,

// macros as defined above

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;



#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>





#define f first

#define s second

#define db long double

#define pb push_back

#define sz(c) (c).size()

#define all(c) (c).begin(),(c).end()



typedef long long ll;

typedef pair <int , int> ii;

typedef pair <ii , int> iii;

typedef vector <int> vi;

typedef vector <ii> vii;

typedef vector <iii> viii;

typedef vector <vi> vvi;

typedef vector <vii> vvii;



const ll mod = 1e9+7;

const int MAX = 1e5+5;

const db eps = 1e-13;



int memo[MAX][2];

int n;

vvi g;



int dp( int node, int color , int p = -1 ) {



    if( memo[node][color] != -1 )

        return memo[node][color];



    int &res = memo[node][color];

    res = 1;

    if( sz(g[node]) == 1 && p != -1 ) {



        return res = res + (!color);



    }



    ll res1 = 1;

    ll res2 = 1;



    for( int nw: g[node] ) {

        if( nw==p )

            continue;



        if( !color )

            res1 = ( 1ll * res1 * dp( nw , color , node ) ) % mod;

        res2 = ( 1ll * res2 * dp( nw , color^1 , node ) ) % mod;

    }

    return res = ((!color)*res1+res2)%mod;

}





int main()

{

	ios_base::sync_with_stdio(0);

	cin.tie(0); cout.tie(0);

    cout<<setprecision(11)<<fixed;



    memset( memo , -1 , sizeof memo );

    cin>>n;

    if( n==1 ) {

        cout<<2<<"\n";

        return 0;

    }



    vi v;

    g = vvi(n+1,v);

    for( int i = 1; i < n ; i++ ) {

        int a, b;

        cin>>a>>b;

        g[a].pb(b);

        g[b].pb(a);

    }

    cout<<dp( 1 , 0 )<<"\n";



}

/*

10

8 5

10 8

6 5

1 5

4 8

2 10

3 6

9 2

1 7

*/