#include <bits/stdc++.h>
 using namespace  std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
const double pi=3.1415926535897932384626433832;
const long long mod=1e9+7;
//long long primeset[5000000]={};
typedef complex<double> cd;
typedef long long ll;
typedef double ld;
//#define For(i,0,n) for(long long i = 0 ; i<n ;i++) 
cd fast_exp(cd a, long long b)
{
	if (b == 0)
		return 1;
	
	cd res = fast_exp(a, b / 2);
		
	res = res * res;
	
	if (b % 2 == 1)
		res = res * a;
	
	return res;
}

long long fastexpon(long long a,long long b,long long mod)
{
	if(b==0)
		return 1;
	
	long long res=fastexpon(a,b/2,mod);
	
	res=(res*res)%mod;
	if(b%2==1)
		res= (res * a)%mod;

	return res;
}


//TEMPLATE ENDS HERE!!!! ------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------------------------------



























vector <ll> edge[100008];
 ll dp[100010]={};
 ll visited[100010]={};
// ll ways(ll x)
// {
// 	ll ways1=1 , ways2=1;
// 	visited[x]=1;
// 	//cout<<"hey";
// 	if(dp[x]>0)
// 		return dp[x];
// 	ll tovis=0;
// 	for(ll i=0 ;i<edge[x].size() ;i++)
// 	{
// 		if(!visited[edge[x][i]])
// 		tovis++;
// 	}
// 	if(tovis==0)
// 	{
// 		dp[x]=2;
// 		return dp[x];
// 	}

// 	if(edge[x].size()==1 && visited[edge[x][0]] == 1)
// 	{
// 		dp[x]=2;
// 		return dp[x];
// 	}
// 	for(ll i=0 ;i<edge[x].size() ;i++)
// 	{
// 		if(!visited[edge[x][i]])
// 		{
// 			ways1=(ways1*ways(edge[x][i]))%mod;
// 			visited[edge[x][i]]=0;
// 		}

// 	}

// 	for(ll i=0 ;i<edge[x][i] ;i++)
// 	{
// 		if(!visited[edge[x][i]])
// 		{
// 			visited[edge[x][i]]=1;

// 			for(auto e : edge[edge[x][i]])
// 			{
// 				//cout<<"hoo";
// 				if(e!=x)
// 				ways2=(ways2*ways(e))%mod;
// 			}
// 		}
// 	}

	
// 	dp[x]=(ways1+ways2)%mod;
// 	return dp[x];

// }



int main()
 {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;	
	cin>>n;
	if(n==1)
	{
		cout<<2<<'\n';
		return 0;
	}
	
	for(ll i=0 ;i<n-1 ;i++)
	{
		//cin>>n;
		ll a,b;
		cin>>a>>b;
		edge[a].pb(b);
		edge[b].pb(a);
	}
	ll num_vis=0;
	queue <ll> q;
	stack <ll> fq;
	q.push(1);
	visited[1]=1;
	while(!q.empty())
	{
		ll top=q.front();
		q.pop();
		fq.push(top);

		for(auto e : edge[top])
		{
			if(!visited[e])
				{
					visited[e]=1;
					q.push(e);
				}	
		}

	}
	for(ll i=0 ; i<=n ;i++)
		visited[i]=0;
	while(!fq.empty())
	{
		
		ll ways1=1,ways2=1;
		ll top = fq.top();
		fq.pop();
		//cout<<"top=      "<<top<<'\n';
	
		ll check=0;
		for(auto e: edge[top])
		{
			if(visited[e])
				check=1;
		}

		if(check==0)
		{
			dp[top]=ways1+ways2;
			//cout<<"dp[] of " <<top<<"   is= "<<dp[top]<<'\n';
		}

		else
		{
			
			for(auto e: edge[top])
			{
				if(visited[e]==1)
				{
					ways1=(ways1*dp[e])%mod;
					

					for(auto f: edge[e])
					{
						if(visited[f]==1)
							ways2=(ways2*dp[f])%mod;
					}
				}

			}
			//cout<<"ways 1 = "<<ways1<<"  ways2=  "<<ways2<<'\n';
			dp[top]=(ways1+ways2)%mod;
				//cout<<"dp[] of " <<top<<"   is= "<<dp[top];
		}
		visited[top]=1;
			
	}

	cout<<dp[1]<<'\n';

	//cout<<ways(1)<<'\n';
	//cout<<ways(1)<<'\n'<<ways(2)<<'\n'<<ways(3)<<'\n';
	//cout<<'\n'<<"time elapsed: "<<clock()*1000.0 / CLOCKS_PER_SEC<<" ms"<<'\n';
	return 0;
}	

Measured memory_bytes: 9344