#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v[100001], distances;
int vis[100001];
long double dfs(int idx) {
  vis[idx] = 1;
  int cnt = 0;
  long double ret = 0;
  bool endpoint = true;
  for (int i = 0; i < v[idx].size(); ++i)
    if (!vis[v[idx][i]]) ret += dfs(v[idx][i]) + 1, cnt++;
  if (!cnt) return 0;
  return ret / cnt;
}
int main() {
  memset(vis, 0, sizeof vis);
  cin >> n;
  for (int i = 0, a, b; i < n - 1; ++i)
    cin >> a >> b, v[a].push_back(b), v[b].push_back(a);
  cout << setprecision(10) << dfs(1);
  return 0;
}
