#include <bits/stdc++.h>
#define MOD (int)(1e9+7)

using namespace std;

vector<int> adj[100005];
int mem[100005][2];
int n;

int go(int x,int l,int pa=-1)
{
	if(mem[x][l]!=-1) return mem[x][l];
	mem[x][l]=1;
	long long bl=(l==0),wh=1;
	for(int i:adj[x])
	{
		if(i==pa) continue;
		wh*=go(i,0,x);
		wh%=MOD;
		bl*=go(i,1,x);
		bl%=MOD;
	}
	//cout << x << " " << l << " " << bl << " " << wh << endl;
	return mem[x][l]=(wh+bl)%MOD;
}

int main()
{
	cin >> n;
	for(int i=1;i<n;i++)
	{
		int x,y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	memset(mem,-1,sizeof mem);
	cout << go(1,0) << endl;
}