#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > graph;
vector<int> visited;
vector<double> storage;
int main() {
  double dfs(int);
  int n;
  cin >> n;
  graph.resize(n);
  visited.resize(n);
  storage.resize(n);
  double answer = 0;
  fill(visited.begin(), visited.begin() + n, 0);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  visited[0] = 1;
  answer = dfs(0);
  cout << setprecision(10) << answer << "\n";
}
double dfs(int current) {
  int counter = 0;
  visited[current] = 1;
  auto it = graph[current].begin();
  double score = 0;
  while (it != graph[current].end()) {
    if (visited[*it] == 0) {
      visited[*it] = 1;
      score += (dfs(*it) + 1);
      counter++;
    }
    it++;
  }
  if (counter == 0) {
    return 0.0;
  }
  double temp = score / counter;
  return temp;
}
