#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int> > G;
double dfs(int u, int p = -1) {
  double res = 0;
  int cnt = 0;
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (v == p) continue;
    cnt++;
    res += dfs(v, u);
  }
  return (cnt ? res / cnt + 1 : 0);
}
int main() {
  cin >> n;
  m = n - 1;
  G.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  cout << setprecision(7) << fixed << dfs(1);
  return 0;
}
