#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define SIZE 100005
#define ll long long
vector< int > v[SIZE];
ll b[SIZE]={0};
ll w[SIZE]={0};


void dfs(int node, int par)
{

	ll sum1=1;
	ll sum2=1;
	for(auto i: v[node])
	{
		if(i==par)
			continue;
		dfs(i,node);
        sum1= ((sum1%MOD)*(w[i]%MOD))%MOD;
        sum2= ((sum2%MOD)*(((w[i]%MOD+b[i]%MOD)%MOD)%MOD))%MOD;
	}

	b[node]=sum1%MOD;
	w[node]=sum2%MOD;
}
int main()
{
	int n;
	cin>>n;
	int node1,node2;
	for(int i=1;i<n;i++)
	{
		cin>>node1>>node2;
		v[node1].push_back(node2);
		v[node2].push_back(node1);
	}

	dfs(1,0);
	cout<<(b[1]+w[1])%MOD<<endl;
	return 0;
}