#include <bits/stdc++.h>
using namespace std;
int N, i, X, Y, E[100005];
int inp() {
  cin >> Y;
  return Y;
}
void proc() {
  for (i = 2 * N - 1; i > 1; i--) E[inp()]++;
  Y = 1;
}
int outp() { return (N == 1) ? 1 : (((long long)Y * (N + X)) % 1000000007); }
int main() {
  cin >> N;
  for (proc(); i <= N; i++) (E[i] == 1) ? X++ : Y = (2 * Y) % 1000000007;
  cout << outp() << '\n';
}
