#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-12;
const int MOD = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1e6 + 4;
const int maxm = 1e3 + 4;
inline long long rule(long long x) { return (x %= MOD) += x < 0 ? MOD : 0; }
vector<int> G[maxn];
long long dp[maxn][2][2], f[maxn][2][2];
int fa[maxn];
bool mark[maxn];
long long quickpow(long long a, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    p >>= 1;
  }
  return ret;
}
void dfs(int u, int f) {
  fa[u] = f;
  if (G[u].size() == 1 && u != 1) {
    dp[u][0][0] = dp[u][1][1] = 1;
    dp[u][0][1] = dp[u][1][0] = 0;
    mark[u] = true;
    return;
  }
  dp[u][0][0] = 1;
  dp[u][0][1] = 1;
  for (auto v : G[u])
    if (v != f) {
      dfs(v, u);
      dp[u][0][0] = (dp[u][0][0] * (dp[v][1][0] + dp[v][0][0])) % MOD;
      dp[u][0][1] = (dp[u][0][1] * (dp[v][1][1] + dp[v][0][1])) % MOD;
    }
  dp[u][1][1] = dp[u][0][0];
  dp[u][1][0] = dp[u][0][1];
}
void dfs2(int u, int fa) {
  if (u == 1) {
    f[u][0][0] = f[u][1][1] = 1;
    int x = G[1].size() == 1 ? 0 : 1;
    f[u][0][1] = f[u][1][0] = x;
  } else {
    f[u][0][0] = f[fa][0][0] * dp[fa][0][0] % MOD *
                     quickpow(dp[u][0][0] + dp[u][1][0], MOD - 2) % MOD +
                 f[fa][1][0] * dp[fa][0][1] % MOD *
                     quickpow(dp[u][0][1] + dp[u][1][1], MOD - 2) % MOD;
    f[u][1][1] = f[u][0][0] = f[u][0][0] % MOD;
    f[u][0][1] = f[fa][0][1] * dp[fa][0][1] % MOD *
                     quickpow(dp[u][0][1] + dp[u][1][1], MOD - 2) % MOD +
                 f[fa][1][1] * dp[fa][0][0] % MOD *
                     quickpow(dp[u][0][0] + dp[u][1][0], MOD - 2) % MOD;
    f[u][1][0] = f[u][0][1] = f[u][0][1] % MOD;
  }
  for (auto x : G[u])
    if (x != fa) dfs2(x, u);
  return;
}
int n;
int main() {
  int ik, i, j, k, kase;
  scanf("%d", &n);
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  int u, v;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, -1);
  dfs2(1, -1);
  long long ans = dp[1][0][0] + dp[1][1][0];
  for (int i = 2; i <= n; ++i)
    if (mark[i])
      ans = (ans + f[i][0][0] + f[i][1][0]) % MOD;
    else {
      ans = (ans + f[i][0][0] * dp[i][0][0] % MOD +
             f[i][1][0] * dp[i][1][0] % MOD) %
            MOD;
    }
  printf("%lld\n", ans);
  return 0;
}
