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


const long long mod=1e9+7;
int n;
vector<int>adjl[100002];

pair<long long, long long> dfs(int now, int prev){ // black, white
	long long b=1, w=1;
	for (int next : adjl[now]){
		if (next==prev) continue;
		auto tmp=dfs(next,now);
		b*=tmp.second;
		b%=mod;
		w*=tmp.second+tmp.first;
		w%=mod;
	}
	return {b,w};
}

int main(){
	cin >> n;
	for (int i=1;i<n;i++){
		int u, v;
		cin >> u >> v;
		adjl[u].push_back(v);
		adjl[v].push_back(u);
	}
	auto ans=dfs(1,0);
	cout << (ans.first+ans.second)%mod << "\n";
}