#include<bits/stdc++.h>
 
using namespace std;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif
 
#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define int ll
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()
 
#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>
 
#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;
 
ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}
 
ll gcd(ll a, ll b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);        
}
 
ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}
 
ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}
 
const int N = 1e5+1;
int visited[N];
vector<int> graph[N];
int dp[N][2];

void dfs (int index) {
	visited[index] = 1;
	int val1 = 1, val2 = 1;

	int flag = 0;
	for (int a: graph[index]) {
		if (visited[a] == -1) {
			dfs(a);
			val1 = (((dp[a][1] + dp[a][0])%mod) * val1)%mod;
			val2 = (val2 * dp[a][0])%mod;
		}
	}

	dp[index][0] = val1;
	dp[index][1] = val2;
	// if (color == 1) {
	// 	for (int a: graph[index]) {
	// 		if (a == parent)
	// 			continue;

	// 		if (dp[a][0] == -1) {
	// 			dp[index][color] = (dp[index][color] + dfs(a, 0, index))%mod;
	// 		}
	// 		else {
	// 			dp[index][color] = (dp[index][color] + dp[a][0])%mod;
	// 		}
	// 	}
	// }

	// else {
	// 	for (int a: graph[index]) {
	// 		if (a == parent)
	// 			continue;

	// 		if (dp[a][0] == -1) {
	// 			dp[index][color] = (dp[index][color] + dfs(a, 0, index))%mod;
	// 		}
	// 		else {
	// 			dp[index][color] = (dp[index][color] + dp[a][0])%mod;
	// 		}

	// 		if (dp[a][1] == -1) {
	// 			dp[index][color] = (dp[index][color] + dfs(a, 1, index))%mod;
	// 		}
	// 		else {
	// 			dp[index][color] = (dp[index][color] + dp[a][1])%mod;
	// 		}
	// 	}
	// }
	
	// if (dp[index][color] == 0)
	// 	dp[index][color] = 1;
	// return dp[index][color];
}

void solve () {
	int n;
	cin >> n;
	
	for (int i = 0; i < n-1; i++) {
		int a, b;
		cin >> a >> b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	
	memset(visited, -1, sizeof(visited));
	dfs(1);
	
	cout << (dp[1][0] + dp[1][1])%mod << endl;
}
 
signed main() 
{
    fast_cin();
    
    
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    
    
    return 0;    
}

Measured memory_bytes: 19720