#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;
const int N = 1e5 + 5;

ll dp[N][2];
vector <int> g[N];

void go(int u, int p) {
  for(auto v : g[u]) {
    if(v == p) continue;
    go(v, u);
    dp[u][0] = ((dp[u][0] % mod) * (dp[v][0] + dp[v][1]) % mod) % mod;
    dp[u][1] = (dp[u][1] * dp[v][0]) % mod;
  }
}

int main() {
  int n; cin >> n;
  for(int i = 0; i < N; i++) dp[i][0] = dp[i][1] = 1;
  for(int i = 1; i < n; i++) {
    int u, v; cin >> u >> v;
    g[u].push_back(v); g[v].push_back(u);
  }
  go(1, -1);
  cout << (dp[1][0] + dp[1][1]) % mod << '\n';
}