#include<stdio.h>
#include<vector>
#define ll long long
using namespace std;
ll f[100005][2],n,a,b;
ll MOD= (ll) 1e9+7;
vector< vector<ll> > child;
void solve(ll x,ll parent){
	for(ll i=0;i<child[x].size();i++){
		if(child[x][i]!=parent){
			solve(child[x][i],x);
			f[x][0]=f[x][0]*(f[child[x][i]][0]+f[child[x][i]][1])%MOD;
			f[x][1]=f[x][1]*f[child[x][i]][0]%MOD;
		}
	}
}
int main(){
	scanf("%lld", &n);
	child.clear();
	child.resize(n+1);
	for(ll i=1;i<n;i++){
		scanf("%lld %lld", &a,&b);
		child[a].push_back(b);
		child[b].push_back(a);
	}
	for(ll i=1;i<=n;i++){
		f[i][1]=f[i][0]=1;
	}
	solve(1,0);
	printf("%lld", (f[1][1]+f[1][0])%MOD);
}
