#include <bits/stdc++.h>
using namespace std;
int n, ans, x, y;
vector<int> a[200000];
double dfs(int v, int p) {
  int d = a[v].size();
  if (p != -1) d--;
  double ret = 1.0;
  for (int i = 0; i < a[v].size(); i++)
    if (p != a[v][i]) {
      ret += dfs(a[v][i], v) * 1.0 / d;
    }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
  }
  printf("%.12lf", dfs(1, -1) - 1);
  return 0;
}
