#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100000];
long long vis[100000];
long long cnt[100000];
map<long long, long long> m;
long long c;
double dfs(int node, int p) {
  vis[node] = 1;
  double l = 0.0, s = 0.0;
  for (int i = 0; i < adj[node].size(); i++) {
    int child = adj[node][i];
    if (vis[child] == 0) {
      s += 1 + dfs(child, node);
      l++;
    }
  }
  if (l != 0) {
    return s / l;
  }
  return 0.0;
}
int main() {
  ios_base::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(14) << fixed << ans << endl;
}
