#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)(a).size())

#define REP(a, b) for (int a = 0; a < (b); a++)
#define FOR(a, b, c) for (int a = (b); a <= (c); a++)
#define REPD(a, b) for (int a = (b) - 1; a >= 0; a--)
#define FORD(a, b, c) for (int a = (b); a >= (c); a--)

#define MIN(a, b) (a) = min((a), (b))
#define MAX(a, b) (a) = max((a), (b))

#ifdef __DEBUG
#define debug if (true)
#else
#define debug if (false)
#endif

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2> &p) {
  return is >> p.fi >> p.se;
}

// {{{ ModInt<MOD>
// ax + by = gcd(a, b)
template <typename T>
T ext_gcd(T a, T b, T &x, T &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  T xx, yy, g = ext_gcd(b, a % b, xx, yy);
  x = yy;
  y = xx - yy * (a / b);
  return g;
}

template<int MOD>
struct ModInt {
 public:
  using sum_type = int;
  using prod_type = long long;

  static_assert(MOD > 0, "MOD should be positive");
  static_assert(MOD <= numeric_limits<sum_type>::max() - MOD, "Plus should not overflow");
  static_assert(MOD <= numeric_limits<prod_type>::max() / MOD, "Multiply should not overflow");

  struct good_val {};

  ModInt() : val_(0) {}

  ModInt(int val) : val_(val % MOD) { fix(op_neg{}); }

  ModInt(ll val) : val_(val % MOD) { fix(op_neg{}); }

  ModInt(int val, good_val) : val_(val) {
#ifdef __DEBUG
    assert(val_ >= 0 && val_ < MOD);
#endif
  }

  ModInt& operator+=(const ModInt &o) { val_ += o.val_; fix(op_pos{}); return *this; }
  ModInt& operator-=(const ModInt &o) { val_ -= o.val_; fix(op_neg{}); return *this; }
  ModInt& operator*=(const ModInt &o) { val_ = static_cast<prod_type>(1) * val_ * o.val_ % MOD; return *this; }
  ModInt& operator/=(const ModInt &o) { return operator*=(o.inverse()); }

  friend ModInt operator+(ModInt a, const ModInt &b) { a += b; return a; }
  friend ModInt operator-(ModInt a, const ModInt &b) { a -= b; return a; }
  friend ModInt operator*(ModInt a, const ModInt &b) { a *= b; return a; }
  friend ModInt operator/(ModInt a, const ModInt &b) { a /= b; return a; }

  ModInt inverse() const {
    prod_type a, b, g = ext_gcd<prod_type>(val_, MOD, a, b);
    if (g != 1) {
      throw;
    }
    debug assert(((*this) * a).val_ == 1);
    return ModInt(a);
  }

  sum_type get() const { return val_; }

 private:
  sum_type val_;
  struct op_neg {};
  struct op_pos {};

  void fix(op_neg) { if (val_ < 0) val_ += MOD; }
  void fix(op_pos) { if (val_ >= MOD) val_ -= MOD; }
};
// }}}

const int MOD = 1e9 + 7;
using MI = ModInt<MOD>;

const int N = 1e5 + 5;

int n;
vi g[N];
MI dp[N][2];

void dfs(int u, int par) {
  for (int v : g[u]) if (v != par) dfs(v, u);
  // 0
  dp[u][0] = 1;
  for (int v : g[u]) if (v != par) dp[u][0] *= dp[v][0] + dp[v][1];
  //  1
  dp[u][1] = 1;
  for (int v : g[u]) if (v != par) dp[u][1] *= dp[v][0];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  REP(i, n - 1) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].pb(y);
    g[y].pb(x);
  }
  dfs(0, -1);
  cout << (dp[0][0] + dp[0][1]).get() << endl;
}


Measured memory_bytes: 13440