#include<bits/stdc++.h>
using namespace std;
int const mxn = 1e5+10;
long long dp1[mxn],dp2[mxn], mark[mxn];
vector <long long > adj[mxn];
int const mod=1e9+7;


void dfs(int v,int p){
	mark[v] = 1;
	for (auto u : adj[v]){
		if (!mark[u])
			dfs(u,v);
	}
	for (auto u : adj[v]){
		if (u!=p){
			dp1[v] *= ((dp2[u]+dp1[u]));
			dp1[v]%=mod;
			dp2[v] *= ((dp1[u]));
			dp2[v]%=mod;
		}
			
		
	}
}



int main(){
	int n;
	cin>>n;
	for (int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	fill(dp1,dp1+mxn,1);
	fill(dp2,dp2+mxn,1);
	dfs(1,0);
	cout<<(dp1[1]+dp2[1])%mod;
	
}