#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template<class T>using vv = vector<vector<T>>;

#define in(v) v; cin >> v;
// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
const int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}


// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
#else
#define debug(...) 42
#endif

template<int MOD> struct MInt {
  long long val;
  MInt(long long val = 0) : val(val % MOD) { if (val < 0) val += MOD; }
  MInt operator-() const { return MInt(-val); }
  MInt operator+(const MInt& n) const { return MInt(val) += n; }
  MInt operator-(const MInt& n) const { return MInt(val) -= n; }
  MInt operator*(const MInt& n) const { return MInt(val) *= n; }
  MInt operator/(const MInt& n) const { return MInt(val) /= n; }
  MInt& operator+=(const MInt& n) { val = (val + n.val) % MOD; return *this; }
  MInt& operator-=(const MInt& n) { val = (MOD + val - n.val) % MOD; return *this; }
  MInt& operator*=(const MInt& n) { val = (val * n.val) % MOD; return *this; }
  MInt& operator/=(const MInt& n) { val = (*this * n.inv()).val; return *this; }
  bool operator==(const MInt& n) { return val == n.val; }
  bool operator!=(const MInt& n) { return val != n.val; }
  MInt inv() const {
    MInt pow = val, ans = 1;
    for (int p = MOD - 2; p > 0; p >>= 1) {
      if (p & 1) ans *= pow;
      pow *= pow;
    }
    return ans;
  }
  friend ostream& operator<<(ostream& os, const MInt& n) { os<<n.val; return os; }
  friend istream& operator>>(istream& os, MInt& n) { os>>n.val; return os; }
};
const int MOD = 1e9+7;
using mint = MInt<MOD>;

struct Graph {
  vector<vector<int>> edge;
  Graph(int n = 0) {
    resize(n);
  }
  void resize(int n) {
    edge.resize(n, vi());
  }
  void addEdge(int from, int to) {
    edge[from].push_back(to);
  }
};
Graph G;

vv<mint> dp;
mint dfs(int s, int parent, bool filled) {
  // filledがtrueならsは黒で塗られている
  mint ans = 1;
  if (dp[s][filled] != 0)
    return dp[s][filled];
  for (const auto& to : G.edge[s]) {
    if (to == parent)
      continue;
    if (filled)
      ans *= dfs(to, s, false);
    else
      ans *= dfs(to, s, true) + dfs(to, s, false);
  }
  return dp[s][filled] = ans;
}
int main() {
  int in(N);

  G.resize(N);
  dp.resize(N, vector<mint>(2, 0));
  rep(i, N-1) {
    int in(a); int in(b);
    --a, --b;
    G.addEdge(a, b); G.addEdge(b, a);
  }
  cout << dfs(0, -1, true) + dfs(0, -1, false) << endl;
  return 0;
}


Measured memory_bytes: 19584