#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

template<int MOD> struct Fp {
    ll val;
    constexpr Fp(ll v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};


//const int MOD = 998244353;
//const int MOD = 1e6 + 3;
const int MOD = 1e9 + 7;
const int N_MAX = 1e5+5;
using mint = Fp<MOD>;
#define MINT (mint)
//mint:型
mint fact[N_MAX];
void init(){
  fact[0] = fact[1] = 1;
  for(int i = 2; i < N_MAX; i++){
    fact[i] = fact[i-1] * i;
  }
}

mint inv(mint n){
  return MINT 1/n;
}

//二項係数の計算(mod)
mint COM(int n, int k){
  if(n<k) return 0;
  return fact[n]/(fact[k]*fact[n-k]);
}

struct edge{
  vector<int> to;
  bool checked[2] = {false};
};

int N;
vector<edge>G;
vector<mint> dp[2];

//cur番目の頂点を見ていて，状態が0(黒),1(白)
mint dfs(int pare, int cur, int state){
  if(G[cur].to.size()==1 && pare != -1) return dp[state][cur] = 1;
  if(G[cur].to.size()==0) return dp[state][cur] = 1;
  if(G[cur].checked[state])  return dp[state][cur];
  mint ret=1;
  REP(i,G[cur].to.size()){
    mint sum=0;
    if(G[cur].to[i] == pare) continue;
    if(state==1) sum += dfs(cur,G[cur].to[i],0);
    sum +=  dfs(cur,G[cur].to[i],1);
    ret*=sum;
  }
  G[cur].checked[state] = true;
  return dp[state][cur] = ret;
}

int main(void){
  cin >> N;
  G.resize(N);
  dp[0] = vector<mint>(N,0);
  dp[1] = vector<mint>(N,0);
  REP(i,N-1){
    int x,y;cin >> x >> y; 
    x--;y--;
    G[x].to.push_back(y);
    G[y].to.push_back(x);
  }
  cout << dfs(-1,0,0) + dfs(-1,0,1) << endl;
  return 0;
} 



Measured memory_bytes: 16384