#include <bits/stdc++.h>
const int MAXX = 100010;
using namespace std;
int n, x, y;
vector<int> v[MAXX];
double dfs(int p, int q) {
  double sum = 0, cnt = 0;
  for (int i = 0; i < v[p].size(); ++i) {
    int l = v[p][i];
    if (l == q) continue;
    cnt++;
    sum += dfs(l, p) + 1;
  }
  if (cnt == 0) return 0;
  return sum / cnt;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  printf("%.9f\n", dfs(1, 0));
  return 0;
}
