#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
vector<int> g[MAXN + 1];
int lev[MAXN + 1];
double prob[MAXN + 1];
double ans = 0.0;
void fast_io() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
}
void dfs(int u, int p) {
  int occ = 0;
  lev[u] = 1 + lev[p];
  for (auto v : g[u]) {
    if (v == p) continue;
    occ++;
  }
  for (auto v : g[u]) {
    if (v == p) continue;
    prob[v] = (1.0 / occ) * prob[u];
    dfs(v, u);
  }
  if (!occ) ans += prob[u] * (lev[u] - lev[1]);
}
int main() {
  fast_io();
  int n, u, v;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  prob[1] = 1.0;
  dfs(1, 1);
  printf("%.10f\n", ans);
}
