#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define F first
#define S second

const ll P = 1000000007;

using namespace std;

int n;
vector<int> g[101010];
ll dp[2][101010];

void dfs(int i, int p){

	dp[0][i] = 1;
	dp[1][i] = 1;
	
	for(int j : g[i]){
		if(j!=p){
			dfs(j, i);
			dp[0][i] = (dp[0][i]*(dp[0][j]+dp[1][j]))%P;
			dp[1][i] = (dp[1][i]*dp[0][j])%P;
		}	
	}

}

int main(){

	cin >> n;
	for(int i=1; i<n; i++){
		int a, b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	dp[0][1]--;
	dp[1][1]--;
	dfs(1, 0);

	cout << (dp[0][1]+dp[1][1])%P << endl;

	return 0;
}
