#include<bits/stdc++.h>
using namespace std;
#define N 100000
#define mod 1000000007
#define pb push_back
vector<int> nei[N+1];
int dpy[N+1],dpn[N+1];
int dp(int x=1,int fa=0){
	dpy[x]=dpn[x]=1;
	for(int i=0,to;i<nei[x].size();i++)if((to=nei[x][i])!=fa){
		dp(to,x);
		dpy[x]=1ll*dpy[x]*dpn[to]%mod;
		dpn[x]=1ll*dpn[x]*(dpy[to]+dpn[to])%mod;
	}
	return (dpy[x]+dpn[x])%mod;
}
int main(){
	int n;scanf("%d",&n);
	while(--n){
		int x,y;scanf("%d%d",&x,&y);
		nei[x].pb(y);nei[y].pb(x);
	}
	printf("%d\n",dp());
	return 0;
}
/*1
3
1 2
2 3
*/
/*2
4
1 2
1 3
1 4
*/
/*3
1
*/
/*4
10
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 2
1 7
*/