#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-7;
const int MAXN = 1e5 + 10;
int dx[] = {1, 0, 0, -1, -1, -1, 1, 1};
int dy[] = {0, 1, -1, 0, 1, -1, 1, -1};
vector<int> adj[1000006];
double dfs(int node, int par) {
  double ans = 0.0;
  int cnt = 0;
  for (auto child : adj[node])
    if (child != par) cnt++, ans += dfs(child, node);
  if (cnt == 0) return 0;
  ans += cnt;
  ans /= cnt;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, a, b;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    a--, b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  cout << fixed << setprecision(10) << dfs(0, -1) << endl;
}
