#include <bits/stdc++.h>
using namespace std;
vector<int> c;
const int PRIME = 1000000007;
long long szybkPot(long long a, int b) {
  if (b == 1) return a;
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long temp = szybkPot(a, b / 2);
    return temp * temp % PRIME;
  } else
    return ((szybkPot(a, b - 1) * a) % PRIME);
}
int main() {
  ios_base::sync_with_stdio(0);
  int a, b, n;
  cin >> n;
  c.resize(n + 1);
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    c[a]++;
    c[b]++;
  }
  int s = 0;
  for (int i = 1; i <= n; i++) {
    if (c[i] == 1) s++;
  }
  cout << (szybkPot(2, n - s) * (s + n)) % PRIME;
}
