记忆化深搜
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#define ll long long
#define PII pair<int, int>
#define TUP tuple<ll, ll, ll>
using namespace std;const int N = 1e5 + 10;
const int mod = 1e9 + 7;
vector<int> edge[N];
int f[N][2] = { 0 };
ll dfs(int node, int c, int fa) {ll ret = 1;for (auto x : edge[node]) {if (x == fa) continue;if (c == 0) {if (!f[x][1]) f[x][1] = dfs(x, 1, node);ret *= dfs(x, 1, node);}else {if (!f[x][1]) f[x][1] = dfs(x, 1, node);if (!f[x][0]) f[x][0] = dfs(x, 0, node);ret *= f[x][1] + f[x][0];}ret %= mod;}return ret;
}
int main() {int n;cin >> n;for (int i = 1; i < n; i++) {int u, v;cin >> u >> v;edge[u].push_back(v);edge[v].push_back(u);}ll ans = dfs(1, 0, -1) + dfs(1, 1, -1);cout << ans % mod;return 0;
}