#include <bits/stdc++.h>
using namespace std;
struct node {
  int u, v;
} a[200010];
int f[200010];
int flag[100010];
int que[100010][2];
bool cmp(const node &a, const node &b) {
  if (a.u == b.u) return a.v < b.v;
  return a.u < b.u;
}
double dfs(int x) {
  int j, num;
  double sum, ans;
  num = 0;
  sum = 0;
  for (j = f[x - 1]; j < f[x]; j++)
    if (flag[a[j].v] == 0) {
      flag[a[j].v] = 1;
      num++;
      sum += dfs(a[j].v);
      flag[a[j].v] = 0;
    }
  if (num == 0)
    ans = 0.0;
  else
    ans = sum / num;
  return ans + 1.0;
}
int main() {
  int n, i, num, sum;
  double ans;
  scanf("%d", &n);
  for (i = 0; i < n - 1; i++) {
    scanf("%d%d", &a[i].u, &a[i].v);
    a[i + n - 1].u = a[i].v;
    a[i + n - 1].v = a[i].u;
  }
  sort(a, a + 2 * n - 2, cmp);
  memset(f, 0, sizeof(f));
  for (i = 0; i < 2 * n - 2; i++) f[a[i].u]++;
  for (i = 1; i <= n; i++) f[i] += f[i - 1];
  flag[1] = 1;
  ans = dfs(1);
  printf("%0.6f\n", ans - 1.0);
  return 0;
}
