// Slower C++ solution:
#include <bits/stdc++.h>

#define rep(i,n) for (ll i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;

const ll INF=1e18;

// auto mod int

// https://youtu.be/L8grWxBlIZ4?t=9858

// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize

// https://youtu.be/8uowVvQ_-Mo?t=1329 : division

const int mod = 1000000007;

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;}

    //a^tを求める

    //例：d[i] = mint(k/i).pow(n);

    //mint(2).pow(n); 2^n

  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;}



ll a[22][22];

mint dp[2][100005];

bool check[100005];



vector<ll> g[100005];



void dfs(ll u,ll p){

  if (check[u])return;

  check[u]=true;

  dp[0][u]=1;

  dp[1][u]=1;



  for (ll to:g[u]){

    if (to==p)continue;

    dfs(to,u);

    dp[0][u]*=(dp[1][to]+dp[0][to]);

    dp[1][u]*=dp[0][to];

  }

//  cout<<dp[0][u]<<"U"<<u<<endl;

}



int main() {

  ll n;

  cin>>n;



  rep(i,n-1){

    ll x1,y1;

    cin>>x1>>y1;

    x1--;y1--;

    g[x1].push_back(y1);

    g[y1].push_back(x1);

  }



  rep(i,2)rep(j,100005)dp[i][j]=1;

  dfs(0,-1);

  mint ans=dp[0][0]+dp[1][0];

  cout<<ans;



}


// Faster C++ solution for the same problem (measured speedup: 1.2441649496803227x):


#include <bits/stdc++.h>

#define rep(i,n) for (ll i = 0; i < n; ++i)

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;

const ll INF=1e18;

// auto mod int

// https://youtu.be/L8grWxBlIZ4?t=9858

// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize

// https://youtu.be/8uowVvQ_-Mo?t=1329 : division

const int mod = 1000000007;



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;}

    //a^tを求める

    //例：d[i] = mint(k/i).pow(n);

    //mint(2).pow(n); 2^n

  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;}





mint dp[2][100005];

std::vector<int> check(100005,-1);

vector<vector<ll>> v(100005);



int dfs(int t,int p){

//  cout<<"t"<<t<<endl;

  if (check[t]!=-1)return 0;

  check[t]=1;

  dp[0][t]=1;  dp[1][t]=1;

  for(int to:v[t]){

    if (to==p)continue;

    dfs(to,t);

    dp[0][t]*=dp[1][to];

    dp[1][t]*=(dp[1][to]+dp[0][to]);

  //  cout<<dp[0][t]<<" "<<dp[1][t]<<"t"<<t<<endl;

  }

  return 0;

}



int main(){

  ll n;

  cin>>n;

  rep(i,n-1){

    ll x1,y1;

    cin>>x1;

    cin>>y1;

    x1--;

    y1--;

    v[x1].push_back(y1);

    v[y1].push_back(x1);



  }

dfs(0,-1);

mint ans=0;

ans+=dp[0][0];

ans+=dp[1][0];

cout<<ans;





}