use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

fn main() {
  let n = read::<usize>();
  let mut v = read_n::<f64>(n);
  let mut answer: f64 = 0.0;

  v.sort_by(|a, b| a.partial_cmp(b).unwrap());

  while v.len() > 1 {
    let x = v.pop().unwrap();
    let y = v.pop().unwrap();
    let item = (x + y) / 2.0;
    answer += item;
    v.push(item);
    v.sort_by(|a, b| a.partial_cmp(b).unwrap());
  }

  println!("{}", answer);
}
