#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll N;
vector<ll> E[100000];
ll dp[100000][2];

void dfs(ll v, ll p) {
  dp[v][0] = 1;
  dp[v][1] = 1;

  for (ll u : E[v]) if (u != p) {
    dfs(u, v);

    dp[v][0] *= dp[u][1];
    dp[v][0] %= MOD;

    dp[v][1] *= (dp[u][0] + dp[u][1]) % MOD;
    dp[v][1] %= MOD;
  }
}

int main(void) {
  cin >> N;
  REP(i, 0, N - 1) {
    ll x, y;
    cin >> x >> y;
    x--;
    y--;
    E[x].push_back(y);
    E[y].push_back(x);
  }

  dfs(0, -1);

  cout << (dp[0][0] + dp[0][1]) % MOD << endl;
}