/**** [ AkJn ] ****/
#include <bits/stdc++.h>
using namespace std;
 
#define fastIO ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define ld long double
#define ll long long
#define min3(a, b, c) min(a,min(b, c))
#define min4(a, b, c, d) min(a, min(b, min(c, d)))
#define max3(a, b, c) max(a,max(b, c))
#define max4(a, b, c, d) max(a, max(b, max(c, d)))
#define yay(x) cout<<endl<<"yay"<<x<<endl;
// #define debug(a) do { std::cout << "Value of " << #a << " is: " << (a) << '\n'; } while(false);
// #define dbg(a) do { std::cout << "Value of " << #a << " is: " << (a) << '\n'; } while(false);
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define dbgendl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cout<<endl;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

/* CHECK THESE POINTS BEFORE SUBMITTING
 * Read the question carefully.
 * Read the code once before final submission.
 * Check the extremities of the constraints.
 * Always check if Binary Search can be applied.
 * 0 is better than -1.
*/

const ll INF = 1e18L + 5;
const ll mod = 1e9+7;

vector<ll int> g[100010];

pair<ll int,ll int> dfs(ll int v,ll int p)
{
    ll int w=1,b=1;
    for(ll int i=0;i<g[v].size();i++)
    {
        if(g[v][i]!=p)
        {
            pair<ll int,ll int> x=dfs(g[v][i],v);
            w=(w*(x.first+x.second)%mod)%mod;
            b=(b*x.first)%mod;
        }
    }
    return mp(w,b);
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
 
    /* 
     * THINK MATHEMATICALLY. IT IS NOT AS TOUGH AS IT SEEMS.
    */
 
    fastIO
 
    ll int n;
    cin >> n;
    for (ll int i = 0; i < n-1; ++i)
   {
        ll int u,v;
        cin >> u >>v;
        g[u].pb(v);
        g[v].pb(u);
   }   
   cout << (dfs(1,-1).first+dfs(1,-1).second)%mod;
   return 0;
}
 
 
// ll int binsearch(ll int l, ll int r){
//     while(l<r){
//         ll int mid = l+(r-l)/2;
//         if(check(mid)){
//             r = mid;
//         }
//         else{
//             l = mid + 1;
//         }
//     }
//     return r;
// }
 
// int find_set(int a){
//     if(a==parent[a]){
//         return a;
//     }
//     return parent[a] = find_set(parent[a]);
// }
 
// void union_sets(int a, int b){
//     a = find_set(a);
//     b = find_set(b);
//     if(a!=b){
//         parent[b] = a;
//         size[a] += size[b];
//     }
// }
 
// bool isPrime(ll int n) 
// {
//     if (n <= 1) return false; 
//     if (n <= 3) return true; 
 
//     if (n%2 == 0 || n%3 == 0) return false; 
  
//     for (ll int i=5; i*i<=n; i=i+6) 
//         if (n%i == 0 || n%(i+2) == 0) 
//            return false;
 
//     return true; 
// }
 
// ll int gcd(ll int a, ll int b)  
// {
//     if (a==0 || b==0){
//         return 0;
//     }
//     if(a==b){
//         return a;
//     }
//     if(a>b){
//         return gcd(a-b, b);
//     }
//     return gcd(a, b-a);
// }

Measured memory_bytes: 12672