#include <bits/stdc++.h>
using namespace std;
int const MAXN = 2e6 + 9;
long double dp[MAXN];
vector<vector<int>> g;
void dfs(int node, int par) {
  bool cond = true;
  for (auto child : g[node]) {
    if (child == par) continue;
    cond = false;
    dfs(child, node);
    dp[node] += dp[child] / (long double)((int)g[node].size() - (node != 1));
  }
  if (!cond) {
    dp[node]++;
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  g.resize(n + 1);
  if (n == 0) {
    cout << 0 << '\n';
    return 0;
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 1);
  cout << setprecision(10) << dp[1] << '\n';
}
