#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long long MOD = 1e9 + 7;
vector<vector<int> > g;
bool vis[100005];
double dfs(int node) {
  vis[node] = 1;
  double sum = 0.0;
  int num = 0;
  for (int i = 0; i < g[node].size(); ++i) {
    int child = g[node][i];
    if (!vis[child]) {
      sum += dfs(child) + 1;
      num++;
    }
  }
  if (num) return sum / num;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  g = vector<vector<int> >(n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    g[x - 1].push_back(y - 1);
    g[y - 1].push_back(x - 1);
  }
  double ans = dfs(0);
  cout << fixed << setprecision(15) << ans;
}
