#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
vector < int > adj[1000000];
int dp1[1000000];
int dp2[1000000];
void dfs(int v, int p)
{
	if(p == -1)
	{
		int x = 1;
		int y = 1;
		dp1[1] = 1;
		dp2[1] = 1;
		for(auto z : adj[v])
		{
			dfs(z, v);
			dp1[1] = (dp1[1] * ((dp1[z]%mod) + (dp2[z]%mod) )%mod )%mod;
			dp2[1] = (dp2[1]*(dp1[z]%mod))%mod;
		}
	}
	dp1[v] = 1;
	dp2[v] = 1;
	for(auto z : adj[v])
	{
		if(z != p)
		{
			dfs(z, v);
			dp1[v] = (dp1[v] * ((dp1[z]%mod) + (dp2[z]%mod) )%mod )%mod;
			dp2[v] = (dp2[v] * (dp1[z]%mod))%mod;
		}
	}
}
signed main()
{
	int n, x, y;
	cin >> n;
	for(int i = 0; i < n - 1; i++)
	{
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	dfs(1, -1);
	cout << (dp1[1] + dp2[1])%mod << endl;
}