#include<bits/stdc++.h>
#define int int64_t
using namespace std;

const int M = 1e9+7;
vector<int> adj[100005] , vis(100005);
int dp[100005][2];

void dfs(int root) {
	vis[root] = 1;
	int b = 1 , w = 1;
	for(auto u:adj[root]) {
		if(!vis[u]) {
			dfs(u);
			b = (b * dp[u][0])%M;
			w = (w * (dp[u][0] + dp[u][1])%M)%M;
		}
	}
	dp[root][0] = w;
	dp[root][1] = b;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

	int n , u , v;
	cin >> n;
	for(int i = 1; i < n; i++) {
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(1);
	cout << (dp[1][1] + dp[1][0])%M << "\n";
	
    return 0;
}
