#include <bits/stdc++.h>
using namespace std;
using namespace placeholders;
template <class T>
void mini(T &l, T r) {
  l = min(l, r);
}
template <class T>
void maxi(T &l, T r) {
  l = max(l, r);
}
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
const int MAXN = 1E6 + 10, MOD = 1E9 + 7;
long long modExp(long long e, long long n, long long m = MOD) {
  long long ret = 1;
  for (; n; n >>= 1, e = e * e % m)
    if (n & 1) ret = ret * e % m;
  return ret;
}
int cnt[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int u, v, i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    ++cnt[u], ++cnt[v];
  }
  int m = 0;
  for (int i = 1; i <= n; ++i) m += cnt[i] == 1;
  printf("%lld\n", (n + m) * modExp(2, n - m) % MOD);
  return 0;
}
