#include <bits/stdc++.h>
#define rep(a,n) for (int a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<int,int> P;
typedef pair<P,int> PP;
//typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;

// auto mod int
// depends on Template

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template<typename T >
struct TreeDP{
    using FX = function<T(T,T)>;//T●T->Tとなる関数の型
    using FA = function<T(T)>;
    const T e;//単位元
    struct Edge{
        int to;
        ll cost;
    };
    using Graph = vector<vector<Edge> >;

    FX merge;
    FA add_root;
    Graph G;
    int n;//木の要素数
    vector< T > dp;

    TreeDP(FX merge_,FA add_root_, int n_, T e_):merge(merge_),add_root(add_root_),n(n_),e(e_){
        dp.resize(n);
        G.resize(n);
    }

    void add_edge(int a,int b){
        G[a].push_back({b});
    }

    void build(){
        dfs(0);
    }

    void dfs(int v,int p=-1){
        T dp_cum = e;
        int deg = G[v].size();
        for(int i = 0; i < deg; i++){
            int x = G[v][i].to;
            if(x==p)continue;
            dfs(x,v);
            dp_cum = merge(dp_cum,dp[x]);
        }
        dp[v] = add_root(dp_cum);
    }
};

struct DP{
    mint white;
    mint black;
};

int main(){
    int n;
    cin >> n;
    auto merge = [](DP dp_cum, DP d) -> DP{
        DP res;
        res.white = dp_cum.white*(d.white+d.black);
        res.black = dp_cum.black*d.white;
        return res;
    };
    auto add_root = [](DP d) -> DP{
        return d;
    };
    TreeDP<DP> tdp(merge,add_root,n,{1,1});//単位元これでいいかな...?
    rep(i,n-1){
        int x,y;
        cin >> x >> y;
        x--;y--;
        tdp.add_edge(x,y);
        tdp.add_edge(y,x);
    }
    tdp.build();
    cout << tdp.dp[0].black+tdp.dp[0].white << endl;

    return 0;
}

Measured memory_bytes: 27788