#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
vector<int> G[100010];
int n;
bool visited[100010];
double dfs(int l) {
  visited[l] = 1;
  if (G[l].size() == 0) return 0;
  int num = 0;
  double sum = 0.0;
  for (int i = 0; i < int(G[l].size()); i++) {
    if (!visited[G[l][i]]) {
      num++;
      sum += 1 + dfs(G[l][i]);
    }
  }
  if (num == 0) return 0;
  sum = sum * 1.0 / num;
  return sum;
}
int main() {
  memset(visited, 0, sizeof(visited));
  int x, y;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    x--;
    y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  double ans = dfs(0);
  cout << setprecision(8) << fixed << ans << endl;
  return 0;
}
