#include<bits/stdc++.h>
#pragma GCC optimize "trapv"
#warning "Running on trapv"
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define REP(n) for(int i = 0; i < n; i++)
#define all(p) p.begin(), p.end()
#define count_1(p) __builtin_popcountll(p)
#define count_0(p) __builtin_ctzll(p)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
template<class X=int>inline X min(X a,X b,X c){return min(min(a,b),c);}
template<class X=int>inline X min(X a,X b,X c,X d){return min(min(a,b,c),d);}
template<class X=int>inline X max(X a,X b,X c){return max(max(a,b),c);}
template<class X=int>inline X max(X a,X b,X c,X d){return max(max(a,b,c),d);}
template<class X=int>inline X mid(X s,X e){return (s+(e-s)/2);}
template<class X=int>inline X len(X s,X e){return (e-s+1);}
const int MOD = 1e9 + 7;
const int oo = 987654321;
const ll OO = 118;
const bool TESTCASES = 0;
const bool CODEJAM = 0;
struct modll{ll v=1;operator ll(){return v;}modll(){}modll(int n){v=n;}modll(ll n){v=n;};
modll operator+(ll b){ll ret=v+b;if(ret>=MOD)ret-=MOD;return {ret};}
modll operator+(int b){ll ret=v+b;if(ret>=MOD)ret-=MOD;return {ret};}
modll operator+(modll b){ll ret=v+b.v;if(ret>=MOD)ret-=MOD;return {ret};}
modll operator-(ll b){ll ret=v-b;if(ret<0)ret+=MOD;return {ret};}
modll operator-(int b){ll ret=v-b;if(ret<0)ret+=MOD;return {ret};}
modll operator-(modll b){ll ret=v-b.v;if(ret<0)ret+=MOD;return {ret};}
modll operator*(ll b){ll ret = (v*b)%MOD;return {ret};}
modll operator*(int b){ll ret = (v*b)%MOD;return {ret};}
modll operator*(modll b){ll ret = (v*b.v)%MOD;return {ret};}
modll &operator+=(modll b){v+=b.v;if(v>=MOD)v-=MOD;return*this;}
modll &operator-=(modll b){v-=b.v;if(v<0)v+=MOD;return*this;}
modll &operator*=(modll b){v=v*b.v%MOD;return*this;}
modll &operator++(int){v++;if(v>=MOD)v-=MOD;return*this;}
modll &operator--(int){v--;if(v<0)v+=MOD;return*this;}
modll inv(modll &x,int y){if(y==0)return {1};
modll p=inv(x,y/2);p=p*p;return(y%2==0)?p:(x*p);}
modll operator/(modll b){return {(v*inv(b,MOD-2))%MOD};}
modll operator/(int b){modll t=b;return{(v*inv(t,MOD-2))%MOD};}
modll operator/(ll b){modll t=b;return{(v*inv(t,MOD-2))%MOD};}
modll &operator/=(modll b){v*=inv(b,MOD-2);return*this;}
friend istream &operator>>(istream &in, modll &c){in>>c.v;return in;}};

void solve() {
	int n;
	cin >> n;
	vector<list<int>> adj(n);
	for(int i = 1, u, v; i < n; i++) {
		cin >> u >> v;
		u--; v--;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	vector<vector<modll>> dp(n, vector<modll>(2));
	function<void(int, int)> dfs = [&](int u, int p) {
		for(int v : adj[u]) if(v^p) {
			dfs(v, u);
			dp[u][0] *= dp[v][1];
			dp[u][1] *= dp[v][0] + dp[v][1];
		}
	};
	dfs(0, -1);
	cout << dp[0][0] + dp[0][1] << "\n";
}

signed main() {
	clock_t start = clock();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int T = 1;
	if(TESTCASES) cin >> T;
	for(int t = 1; t <= T; t++) {
		if(CODEJAM) cout << "Case #" << t << ": ";
		solve();
	}
	cerr << (double)(clock() - start)/CLOCKS_PER_SEC << "\n";
	return 0;
}


Measured memory_bytes: 29788