
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i,n)  for(int i = 0; i < (int)(n);    i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

constexpr ll mod = 1e9+7;

struct Edge {
  int to;
  int cost;
};
std::vector<std::vector<Edge>> G;
std::vector<std::vector<ll>> dp;

ll dfs(int v, int p, bool w) {
  ll rtn = 1;
  if ( dp[v][w] != -1 ) return dp[v][w];
  //std::cout << p << " -> " << v << " : " << (w ? "white" : "black") << std::endl;
  for(auto&& g : G[v]) {
    if ( g.to == p ) continue;
    if ( w ) rtn *= ((dfs(g.to, v, true ) % mod) + (dfs(g.to, v, false) % mod)) % mod;
    else     rtn *= (dfs(g.to, v, true ) % mod);
  }
  return dp[v][w] = rtn%mod;
}

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N; G.resize(N);
  rep(i, N-1) {
    int x, y; std::cin >> x >> y; x--,y--;
    G[x].push_back( Edge({y, 1}) );
    G[y].push_back( Edge({x, 1}) );
  }
  dp.resize(N); rep(i,N) dp[i].assign(2, -1);
  std::cout << (dfs(0, -1, true) + dfs(0, -1, false)) % mod << std::endl;

  return 0;
}

