// Original C++ solution (slower):
#include <iostream>

#include <queue>

#include <map>

#include <deque>

#include <algorithm>

#include <set>

#include <string>

#include <math.h>

#include <stdio.h>

#include <iomanip>

#include <cstring>

#include <climits>

#include <iostream>

 

 

#define ll long long

#define p 1000000007

using namespace std;

//const ll MOD = (int) 10e9 + 7;

 

ll dp[100001][2];

vector<vector<ll>>adj;

/*

ll dfs(ll node)

{

    if (dp[node] != -1)

        return dp[node];

    ll ans = 0;

 

    if (adj[node].size() == 0)

        return 2;

 

    for (int i = 0; i < adj[node].size(); i++) {

        ans = max(dfs(adj[node][i]) + 1, ans);

 

    }

 

 

    return dp[node] = ans;

}

*/

ll dfsColor(ll node, ll parent, ll color)

{

    if (adj[node].size() == 1 && adj[node][0] == parent)

        return dp[node][color] = 1;

 

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

        return dp[node][color] % p;

 

    ll ans = 1;

    for (ll i = 0; i < adj[node].size(); i++)

    {

        if (adj[node][i] != parent)

        {

            ll x,y;

            x = y = 0;

            if (color == 1)

                x = dfsColor(adj[node][i], node, 0) % p;

            y = dfsColor(adj[node][i], node, 1) % p;

            ans *= (x + y);

            ans %= p;

        }

    }

    return dp[node][color] = ans;

}

 

ll factorial(ll n)

{

    if (n == 1 || n == 0)

        return 1;

    return  n * factorial(n - 1);

}

 

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

 

    ll n;

    cin >> n;

    for (int i  = 0; i < n; i++)

    {

        vector<ll>temp;

        adj.push_back(temp);

    }

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

    {

        ll x,y;

        cin >> x >> y;

        x--;

        y--;

        adj[x].push_back(y);

        adj[y].push_back(x);

    }

    if (n == 1)

        cout << 2;

    else

    {

        for (ll i = 0; i < 100001; i++)

            for (ll j = 0; j < 2; j++) dp[i][j] = -1;

 

        ll ans = 1;

        for (ll i = 0; i < n; i++)

        {

            if (dp[i][0] == -1)

                ans *= ((dfsColor(0,0,0) % p) + (dfsColor(0,0,1) % p)) % p;

        }

        cout << ans % p;

    }

    /*std::cout<<std::fixed;

    std::cout<<std::setprecision(10)<<ans;*/

             //   dp[i][i + 1 + j] = min(dp[i][i + j] + (pre[i + j + 2] - pre[i]),dp[i + 1][i + 1 + j] + (pre[i + j + 2] - pre[i]));

 

    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <queue>

#include <map>

#include <deque>

#include <algorithm>

#include <set>

#include <string>

#include <math.h>

#include <stdio.h>

#include <iomanip>

#include <cstring>

#include <climits>

#include <iostream>





#define ll long long

#define p 1000000007

using namespace std;

//const ll MOD = (int) 10e9 + 7;



//ll dp[100001][2];

vector<vector<ll>>adj;

/*

ll dfs(ll node)

{

    if (dp[node] != -1)

        return dp[node];

    ll ans = 0;



    if (adj[node].size() == 0)

        return 2;



    for (int i = 0; i < adj[node].size(); i++) {

        ans = max(dfs(adj[node][i]) + 1, ans);



    }





    return dp[node] = ans;

}

*/

//<white, black>

pair<ll, ll> dfsColor(ll node, ll parent)

{

    ll allWh = 1;

    ll blackChild = 0;

    for (ll i = 0; i < adj[node].size(); i++)

    {

        if (adj[node][i] != parent){

            pair<ll,ll> pr = dfsColor(adj[node][i], node);

            blackChild = ((allWh * pr.second) % p + ((blackChild % p) * (pr.first + pr.second) % p) % p) % p;

            allWh = (pr.first * allWh) % p;

        }

    }

    return make_pair((allWh + blackChild) % p, allWh % p);

}



ll factorial(ll n)

{

    if (n == 1 || n == 0)

        return 1;

    return  n * factorial(n - 1);

}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    ll n;

    cin >> n;

    for (int i  = 0; i <= n; i++)

    {

        vector<ll>temp;

        adj.push_back(temp);

    }

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

    {

        ll x,y;

        cin >> x >> y;

        adj[x].push_back(y);

        adj[y].push_back(x);

    }

    pair<ll, ll> k = dfsColor(1,-1);

    cout << (k.first + k.second) % p;

    /*std::cout<<std::fixed;

    std::cout<<std::setprecision(10)<<ans;*/

             //   dp[i][i + 1 + j] = min(dp[i][i + j] + (pre[i + j + 2] - pre[i]),dp[i + 1][i + 1 + j] + (pre[i + j + 2] - pre[i]));



    return 0;

}


// Fastest known solution for this problem: