#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
vector<int> edges[100005];
int mod=1e9+7;
ll mul(ll a,ll b){
	return a*b%mod;
}
pair<ll,ll> dfs(int a,int parent){
	ll allwhite=1;
	ll smblack=0;
	for(auto b:edges[a]){
		if(b!=parent){
			pair<ll,ll>p=dfs(b,a);
		
		smblack= (mul(allwhite,p.first)+mul(smblack,p.first+p.second))%mod;
		allwhite*=p.second;
		allwhite%=mod;
		}
	}
	return{allwhite,(allwhite+smblack)%mod};
}

int main(){
	ll n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	pair<ll,ll>p=dfs(1,-1);
	
	cout<<(p.first+p.second)%mod;
	
	
	
	
	return 0;
	
}
