#include <bits/stdc++.h>
using namespace std;
double dp[100005];
int vis[100005];
vector<int> adj[100005];
double dfs(int u, int p) {
  double sum = 0.0;
  double count = 0.0;
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i];
    if (v != p) {
      sum += (1.0 + dfs(v, u));
      count += 1.0;
    }
  }
  if (count == 0.0) return 0.0;
  sum = sum / count;
  dp[u] = sum;
  return sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  double ans = dfs(1, 0);
  cout << setprecision(9) << fixed << ans << "\n";
  return 0;
}
