#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
using ll = long long;
using ld = long double;
constexpr int nax = 1000 * 1000 + 105;
constexpr int infty = 1000 * 1000 * 1000 + 5;
constexpr int mod = 1000 * 1000 * 1000 + 7;
void Dodaj(ll& a, ll b) {
  a += b;
  if (a >= mod) a -= mod;
}
ll Mnoz(ll a, ll b) { return (a * b) % mod; }
int n;
vector<int> graf[nax];
ll dp[nax];
ll odp[nax];
void dfs(int w, int o) {
  ll ilo = 1;
  for (int d : graf[w]) {
    if (d == o) continue;
    dfs(d, w);
    ilo = Mnoz(ilo, dp[d]);
  }
  dp[w] = ilo;
  if (graf[w].size() == 0 or (graf[w].size() == 1 and o != -1)) {
  } else {
    Dodaj(dp[w], ilo);
  }
  debug() << "dp[" << w << "] = " << dp[w];
}
void dfs2(int w, int o, ll gora) {
  debug() << "dfs2("
             " ["
          << "w"
             ": "
          << (w)
          << "] "
             " ["
          << "o"
             ": "
          << (o)
          << "] "
             " ["
          << "gora"
             ": "
          << (gora)
          << "] "
             ")";
  const int m = graf[w].size();
  vector<ll> pref(m + 2, 1), suf(m + 2, 1);
  pref[0] = gora;
  for (int i = 0; i < m; i++) {
    if (graf[w][i] == o) {
      pref[i + 1] = pref[i];
    } else {
      pref[i + 1] = Mnoz(pref[i], dp[graf[w][i]]);
    }
  }
  for (int i = m - 1; i >= 0; i--) {
    if (graf[w][i] == o) {
      suf[i + 1] = suf[i + 2];
    } else {
      suf[i + 1] = Mnoz(suf[i + 2], dp[graf[w][i]]);
    }
  }
  suf[0] = Mnoz(suf[1], gora);
  odp[w] = suf[0];
  if (graf[w].empty()) {
  } else {
    Dodaj(odp[w], suf[0]);
  }
  debug() << " ["
          << "w"
             ": "
          << (w)
          << "] "
             " ["
          << "odp[w]"
             ": "
          << (odp[w]) << "] ";
  for (int i = 0; i < m; i++) {
    if (graf[w][i] == o) continue;
    gora = Mnoz(pref[i], suf[i + 2]);
    if (o == -1 and graf[w].size() <= 1) {
    } else {
      gora = Mnoz(gora, 2);
    }
    dfs2(graf[w][i], w, gora);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    graf[a].push_back(b);
    graf[b].push_back(a);
  }
  dfs(1, -1);
  dfs2(1, -1, 1);
  ll wyn = 0;
  for (int i = 1; i <= n; i++) {
    Dodaj(wyn, odp[i]);
  }
  printf("%lld\n", wyn);
  return 0;
}
