#include <cstdio>
#include <vector>
#include <tuple>

int n;
std::vector<std::vector<int> > G;

constexpr int mod = 1000000007;

int dp[100000];

std::pair<int, int> dfs(int p, int x){
  long long int s = 1;
  long long int t = 1;
  for(int y: G[x]){
    if(y == p) continue;
    int a, b;
    std::tie(a, b) = dfs(x, y);
    s = s * (a + b) % mod;
    t = t * a % mod;
  }
  return {s, t};
}

int main(){
  scanf("%d", &n);
  G.resize(n);
  for(int i = 0; i < n-1; i++){
    int x, y;
    scanf("%d%d", &x, &y);
    G[x-1].push_back(y-1);
    G[y-1].push_back(x-1);
  }

  int a, b;
  std::tie(a, b) = dfs(-1, 0);
  printf("%d\n", (a+b) % mod);
  return 0;
}
