<?php

$N = trim(fgets(STDIN));
$v = explode(' ', trim(fgets(STDIN)));
$v = array_map('intval', $v);
sort($v);

while (count($v) != 1) {
    $sliced = array_slice($v, 0, 2);
    $v = array_diff($v, $sliced);
    $sum = array_sum($sliced);
    $ans = $sum / 2;
    array_unshift($v, $ans);
}

echo $v[0], "\n";
