N = int(input())
V = list(map(int, input().split()))
V.sort(reverse=True)
V = iter(V)
res = 0
L = N.bit_length()
for i in range(L):
    if (N>>i)&1 != 1:
        continue
    for _ in range(1<<i):
        v = next(V)
        res += v/(1<<(i+1))

print(res)