Problem:
 Score : 300 points    Problem Statement You have a pot and N ingredients. Each ingredient has a real number parameter called value , and the value of the i -th ingredient (1 \leq i \leq N) is v_i .  When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.  After you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.      Constraints  2 \leq N \leq 50  1 \leq v_i \leq 1000  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  v_1  v_2  \ldots  v_N       Output Print a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.  Your output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5} .        Sample Input 1 2
3 4      Sample Output 1 3.5  If you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5 .  Printing 3.50001 , 3.49999 , and so on will also be accepted.       Sample Input 2 3
500 300 200      Sample Output 2 375  You start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:   Use the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400 . The next composition will use this ingredient and the ingredient of value 200 , resulting in an ingredient of value (400 + 200) / 2 = 300 .  Use the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350 . The next composition will use this ingredient and the ingredient of value 300 , resulting in an ingredient of value (350 + 300) / 2 = 325 .  Use the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250 . The next composition will use this ingredient and the ingredient of value 500 , resulting in an ingredient of value (250 + 500) / 2 = 375 .   Thus, the maximum possible value of the last ingredient remaining is 375 .  Printing 375.0 and so on will also be accepted.       Sample Input 3 5
138 138 138 138 138      Sample Output 3 138

Solution (Python):

N = input()
v = list(map(int, input().split()))

v.sort(reverse=True)
ave = v.pop()
while len(v) > 0:
	new = v.pop()
	ave = (ave + new)/2

print(ave)

Solution (Python):
N = int(input())
v = list(map(int,input().split()))
sv = sorted(v, reverse=True)
var = 0
for k in range(N):
  if k == N-1:
    var = var + sv[k]/(2**(N-1))
  else:
    var = var + sv[k]/(2**(k+1))
print(var)

Solution (Python):
N = int(input())
v = list(map(int, input().split()))
v.sort()

sum = 0.0
h = [0.0]*N

for i in range(2): 
    h[i] = ((0.5)**(N-1))*v[i]

for i in range(2,N):
    h[i] = ((0.5)**(N-i))*v[i]

for i in range(N):
    sum = sum + h[i]
    
print(sum)

Solution (Python):
N = int(input())
V = map(int, input().split())
V_sort = sorted(V)
V_max = V_sort[0]
for i in range(1, N):
    V_max = (V_max + V_sort[i])/2

print(V_max)

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
V_s = sorted(V)
while len(V_s) > 1:
  V_s = sorted(V_s)
  add = (V_s[0] + V_s[1])/2
  V_s.pop(0)
  V_s.pop(0)
  V_s.append(add)
print(V_s[0])

Solution (Python):


N = int(input())
V = sorted(list(map(int, input().split())), reverse=True)

while len(V)>1:
    min1 = V.pop(-1)
    min2 = V.pop(-1)

    V.append((min1+min2)/2)
    V = sorted(V, reverse=True)

print(V[0])

Solution (Python):
n = int(raw_input())
v = map(int, raw_input().split())
new_v = sorted(v)
pre_v = new_v[0]
out = 0.0
for i in range(1,n):
    out = (pre_v + float(new_v[i]))/2.0
    pre_v = (pre_v + float(new_v[i]))/2.0
print(out)

Solution (Python):
n = int(input())
arr = list(map(int,input().split()))
arr.sort()
if n == 2:
    arr[0]=(arr[0]+arr[1])/2
else:
    for i in range(n-1):
        for j in range(n-2):
            arr[j]=(arr[j]+arr[j+1])/2
            arr[j+1]=arr[j+2]
print(arr[0])

Solution (Python):
a = int(input())
b = list(map(int, input().split()))
b = sorted(b)

def cal(x,y):
  return (x+y)/2

ans = cal(b[0],b[1])

if a >= 3:
  for i in range(a):
    i = i+2
    if i > a-1:
      break
    ans = cal(ans,b[i])
    
print(ans)

Solution (Python):
n=int(input())
value=sorted(list(map(int, input().split())))

for _ in range(n-1):
    value=sorted(value)
    value_next=((value[0]+value[1])/2)
    value=value[2:]
    value.append(value_next)
print(value[0])

Solution (Python):
N = int(input())
v = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    if i == 0:
        ans += v[i]
        continue
    ans = (ans + v[i]) / 2
print(ans)

Solution (Python):

import sys


def solve(N: int, v: "List[int]"):
    v.sort()

    while(len(v) != 0):
        if(len(v) == 1):
            x = v.pop(0)
            print(x)
            exit()
        a = v.pop(0)
        b = v.pop(0)
        v.append((a+b)/2)
        v.sort()
    

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    v = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, v)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
v = list(map(int, input().split()))
v2 = sorted(v)

while len(v2)>0:
  if len(v2) == 1:
    print(v2[0])
    quit()
  new = (v2[0]+v2[1])/2
  v2.append(new)
  v2.pop(0)
  v2.pop(0)
  v2.sort()

Solution (Python):
def solve(n, l):
    for i in range(n-1):
        a = min(l)
        l.remove(min(l))
        b = min(l)
        l.remove(min(l))
        l.append((a + b)/2)
    return l

def main():
    n = int(input())
    l = list(map(int, input().split(" ")))
    print(*solve(n, l))

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))

arr = sorted(arr)

total = (arr[0] + arr[1])/2

for i in range(2, n):
    total = (total + arr[i])/2

print(total)

Solution (Python):



N = int(input())
v = list(map(int,input().split()))

if N == 1:
    print(v[0])
elif N == 2:
    avg = (v[0] + v[1])/2
    print(avg)
else:
    v.sort()
    avg = (v[0] + v[1])/2
    for i in range(2,N):
        avg = (avg + v[i]) /2
    print(avg)

Solution (Python):
n = int(input())
v = list(map(int, input().split()))

v.sort()

a = v[0]

for i in v:
    a = (a + i)/2

print(a)

Solution (Python):
N = int(input())
v = list(map(int, input().split()))

ans = 0

v.sort()

while len(v) != 0:
    if ans == 0:
        ans = (v[0]+v[1]) / 2
        v.pop(0)
        v.pop(0)

    else:
        ans = (ans+v[0]) / 2
        v.pop(0)
print(ans)

Solution (Python):
n = input()
val = sorted([int(i) for i in input().split()])

ave = val[0]
for v in val[1:]:
    ave = float((v + ave)/2)

print(ave)

Solution (Python):
_=input()
ans=0
for i,v in enumerate(sorted(list(map(int,input().split())))):
	ans+=v
	if i==0:continue
	ans/=2
print(ans)

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
V.sort()
value = 0
for i in range(N-1):
    V[i+1] = (V[i] + V[i+1])/2
print(V.pop())

Solution (Python):
N=int(input())
v=list(map(int,input().split()))

v.sort()
ans = v[0]
for i in range(1,N):
    ans = (ans + v[i])/2
print(ans)

Solution (Python):
n = int(input())
aryNum = list(map(int, input().split()))

while (len(aryNum) > 1):
    aryNum.sort()
    a = aryNum[0]
    b = aryNum[1]
    aryNum.remove(a)
    aryNum.remove(b)
    aryNum.append((a + b) / 2)

print(aryNum[0])

Solution (Python):
n = int(input())
v = list(map(int,input().split()))
v.sort()
for i in range(n-1):
  v[i+1] = (v[i] + v[i+1])/2
print(v[n-1])

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    n = int(input())
    v_list = sorted([int(i) for i in input().split()])
    result = sum(v_list[:2]) / 2
    
    
    for i in v_list[2:]:
        result = (result + i) / 2
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
v = list(map(int, input().split()))
v.sort()
ans=v[0]
for i in range(1,n):
    ans=(ans+v[i])/2
print(ans)

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
V = sorted(V)

while len(V)>1:
  New=(V[0]+V[1])/2
  del V[0:2]
  V.append(New)
  V=sorted(V)

print(V[0])

Solution (Python):
n = int(input())
v = list(map(int,input().split()))
v.sort()
total = v[0]
for i in range(1,n):
    total = (total + v[i]) / 2 
print(total)

Solution (Python):

n = int(input())
v = list(map(int, input().split()))
while len(v) != 1:
    v.sort(reverse=True)
    t = (v.pop(), v.pop())
    v.append(sum(t)/2)
print(v[0])

Solution (Python):
n = int(input())

nums = list(map(int,input().split()))

nums.sort()


index = 0
while index < n-1:
    nums.append((float)(nums.pop(0)+nums.pop(0))/2)
    nums.sort()
    index = index + 1

print(nums.pop(0))

Solution (Python):
N = int(input())
vi = list(map(int,input().split()))
vi_sort = sorted(vi)

if N == 2:
  print((vi[0]+vi[1])/2)
else:
  i = 0
  while i < (N-1):
    new_number = (vi_sort[0]+vi_sort[1])/2
    del vi_sort[0:2]
    vi_sort.append(new_number)
    vi_sort.sort()
    i += 1
    
  print(vi_sort[0])

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
V.sort()
v_sum = (V[0]+V[1]) / (2**(len(V)-1))
for i in range(2, len(V)):
  v_sum += V[i] / (2**(len(V)-i))
print(v_sum)

Solution (Python):
N = int(input())
value_list = [int(i) for i in input().split()]
value_list.sort()
for i in range(N-1):
    min1 = value_list[0]
    min2 = value_list[1]
    value_list.remove(min1)
    value_list.remove(min2)
    add = (min1+min2)/2
    value_list.append(add)
    value_list.sort()
print(value_list[0])

Solution (Python):
n =int(input())
a = list(map(int,input().split()))

b = a.sort()

for i in range(n-1):
    c=(a[0]+a[1])/2
    a.pop(1)
    a.pop(0)
    a.insert(0,c)
    
print(a[0])

Solution (Python):
N = int(input())
v = list(map(int, input().split()))

V = sorted(v)
summ = (V[0] + V[1])/2
for i in range(2, len(V)):
    summ = (summ + V[i])/2
print(summ)

Solution (Python):
n = int(input())
v = [int(x) for x in input().split()]
v.sort()

max_value = (v[0] + v[1]) / 2

for y in range(n - 2):
    max_value = (max_value + v[y + 2]) / 2

print(max_value)

Solution (Python):
import heapq

if __name__ == "__main__":
    
    N = int(input())
    v = list(map(int, input().split()))

    heapq.heapify(v)
    for i in range(N-1):
        a = heapq.heappop(v)
        b = heapq.heappop(v)
        heapq.heappush(v, float((a+b)/2))
    
    print(v[0])

Solution (Python):
import heapq

N = int(input())
V = list(map(int, input().split()))

h = []
for v in V:
  heapq.heappush(h, v)

total = 0
for n in range(N - 1):
  x = heapq.heappop(h)
  y = heapq.heappop(h)
  a = (x + y) / 2
  heapq.heappush(h, a)
print(heapq.heappop(h))

Solution (Python):

from collections import deque

N = int(input())

V = list(map(int, input().split(" ")))

V.sort()

V_deque = deque(V)

while len(V_deque) > 1:
    V1 = V_deque.popleft()
    V2 = V_deque.popleft()

    V_deque.append((V1 + V2)/2)

    V_list = list(V_deque)
    V_list.sort()
    V_deque = deque(V_list)

print(V_deque.popleft())

Solution (Python):
def solve():
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()
    total = v[0]
    for i in range(1,n):
        total += v[i]
        total /= 2.0
    print(total)

if __name__=="__main__":
    solve()

Solution (Python):
N = int(input())
V = list(map(int,input().split()))

V.sort()
sum = 0
count = 0

for v in V:
    if count == 0:
        sum += v/(2**(N-1))
    else:
        sum += v/(2**(N-count))
    count += 1

print(sum)

Solution (Python):
def main():
  n=int(input())
  v=list(map(int,input().split()))
  total=0
  v.sort()

  v[0]=(v[0]+v[1])/2
  v[1]=1001
  for i in range(1,n-1):
    v.sort()
    v[0]=(v[0]+v[1])/2
    v[1]=1001
 
  
  print(v[0])
if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
V = [int(i) for i in input().split()]
V.sort()
ans = (0.5 ** (n-1)) * V[0]
for i in range(1,n):
    ans = ans + (0.5 ** (n-i)) * V[i]
print(ans)

Solution (Python):



N = int(input())
v = list(map(int, input().split()))


v.sort()
first = sum(v[0:2]) / 2
if N != 2:
    tmp = first
    for i in range(2, N):
        ans = (tmp + v[i]) / 2
        tmp = ans
else:
    ans = first


print(ans)

Solution (Python):
n=int(input())
v=sorted(map(int,input().split()))
r=v[0]
for i in range(1,n):
    r=(r+v[i])/2
print(r)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))

l=sorted(l)
a=l[0]

for i in range(1,n-1):
  if i==1:
    x=(a+l[i])/2
    l[i]=x
    
  else:
    x=(l[i-1]+l[i])/2
    l[i]=x
    
ans=(l[n-2]+l[n-1])/2
print(ans)

Solution (Python):
n=int(input())
lista=sorted(map(int,input().split()))
print(sum(lista[i]/(2**(n-i)) for i in range(n))+lista[0]/(2**n))

Solution (Python):
import fractions

N = int(input())
V = list(map(int, input().split()))
V.sort()
ans = fractions.Fraction(V[0] + V[1], 2)
for i in range(2, N):
    ans = fractions.Fraction((ans + V[i]), 2)
print(float(ans))

Solution (Python):
from heapq import heappop,heappush
N = int(input())
V = list(map(int,input().split()))
V.sort()
while True:
    if len(V) == 1:
        break
    a = heappop(V)
    b = heappop(V)
    heappush(V,(a + b) / 2)
print(heappop(V))

Solution (Python):
n = int(input())
li = list(map(int, input().split()))
new_li = sorted(li)
ans = (new_li[0] + new_li[1]) / 2
i = 2
for l in range(n - 2):
    ans = (ans + new_li[i]) / 2
    i += 1
print(str(ans))

Solution (Python):
import functools


def solve(vs):
    ws = sorted(vs)
    res = functools.reduce(lambda x, y: (x + y) / 2, ws)
    return res


def main():
    _ = int(input())
    vs = [int(v) for v in input().split()]
    res = solve(vs)
    print("{:.12f}".format(res))


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
V = [int(s) for s in input().split(" ")]
V_sort = sorted(V)

sumV = 0
for i,x in enumerate(V_sort):
    p = max(0,i-1)
    sumV += x*(2**p)
    
res = sumV/2**(N-1)
print(res)

Solution (Python):
def main():
    n = int(input())
    vs = sorted(map(int, input().split()))

    for i in range(len(vs)-1):
        if i == 0:
            ans = (vs[i] + vs[i+1])/2
        else:
            ans = (ans + (vs[i+1]))/2

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
s=(a[0]+a[1])/2
for i in range(n-2):
    s=(s+a[i+2])/2
print(s)

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
v.sort()
t=v[0]/(2**(n-1))
for i in range(1,n):
  t+=v[i]/(2**(n-i))
print(t)

Solution (Python):
N = int(input())
v = list(map(int,input().split()))
v.sort()
a = 0
for i in range(N-1):
    v.sort()
    a = (v[0]+v[1])/2
    v[0] = v[0]+2000
    v[1] = v[1]+2000
    v.append(a)
    
print(a)

Solution (Python):
N = int(input())
V = list(map(int,input().split()))
V = sorted(V)
a = V[0]
for i in range(1,N):
    a = (a+V[i])/2
print(a)

Solution (Python):
N = int(input())
v = list(map(int, input().split()))
v.sort()
for i in range(N-1):
    v[i+1] = (v[i+1] + v[i])/2

print(v[-1])

Solution (Python):
N = int(input())
s = list(map(float, input().split()))

a = sorted(s)

for i in range(N-1):
  a = sorted(a)
  a[i+1] = (a[i] + a[i+1]) / 2
  a[i] = 0

print(a[N-1])

Solution (Python):
result = 0
N = int(input())
array=[int(x) for x in input().split()]
array = list(array)


while(len(array)!=1):
    array.sort()
    newNum = array[0]+array[1]
    del array[0]
    del array[0]
    array.append(newNum/2)

print(array[0])

Solution (Python):
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = (v[0] + v[1]) / 2
for i in range(2,N):
  ans = (ans + v[i]) / 2
print(ans)

Solution (Python):
n = int(input())

arr = list(map(int, input().split(" ")))

arr.sort()

ans = arr[0]
for i in range(n - 1):
    ans = ((ans + arr[i + 1]) / 2.)

print(ans)

Solution (Python):
N = int(input())
V = list(map(int, input().split(' ')))
V = sorted(V)
for v in range(N-1):
    a = V.pop(0)
    b = V.pop(0)
    V.insert(0,(a+b)/2)
    
print(V[0])

Solution (Python):
N,*v=map(int,open(0).read().split())

v = sorted(v)
while(len(v)>1):
  s=(v[0]+v[1])/2
  v.append(s)
  v = v[2:]
  v = sorted(v)

print(v[0])

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
li.sort()
score = li[0] / (2 ** (n - 1))
del li[0]

for i in range(len(li)):
  score += li[i] / (2 ** (n - 1 - i))
print(score)

Solution (Python):
N = int(input())
V = list(map(int,input().split()))
V.sort()
a = V[0]
for i in range(1,N):
  a = (a + V[i]) / 2
print(a)

Solution (Python):
N = int(input())
V = list(map(int, input().split()))

V = sorted(V, reverse=True)
total = 0
for i in range(len(V)):
    total += V[i] * 2 ** (-i-1)
total += V[N-1] * 2 ** (-N)
print(total)

Solution (Python):
n = int(input())
v = list(map(int, input().split()))
vsr = sorted(v)
ans = (vsr[0]+vsr[1])/2
if n > 2:
	for i in range(2,n):
	   ans = (ans+vsr[i])/2
print(ans)

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
v.sort()
while len(v)>1:
    maze=(v.pop(1)+v.pop(0))/2
    v.insert(0,maze)
print(v[0])

Solution (Python):

N = int(input())
v = sorted(list(map(int, input().split())))

total = (v[0] + v[1]) / 2
for i in range(2, len(v)):
    total = (total + v[i]) / 2
print(total)

Solution (Python):
N = int(input())
v = input().split()
v_list = [int(i) for i in v]
v_list = sorted(v_list, reverse = True)
if len(v_list) > N:
  v_list = v_list[:N+1]
def calc(a, b):
  return (a+b)/2
for i in range(N):
  a = v_list.pop()
  b = v_list.pop()
  v_list.append(calc(a,b))
  if len(v_list) < 2:
    break
print(v_list[0])

Solution (Python):
N = int(input())
vlist = list(map(int, input().split()))

for x in range(1, N):
    vlist.sort()
    new = (vlist[0] + vlist [1])/2
    del vlist[0:2]
    vlist.insert(0, new)

print(vlist[0])

Solution (Python):
N = int(input())
v = list(map(int, input().split()))
v.sort()
value = v[0]

for i in range(N - 1):
    value = (value + v[i + 1]) / 2

print(value)

Solution (Python):

N = int(input())

value = list(map(int , input().split()))
value.sort()

for i in range(N-1):
  value[i+1] = (value[i] + value[i+1])/2
  
print(value[-1])

Solution (Python):
def main():
    N=int(input())
    V=list(map(int,input().split()))
    V.sort()
    ans=V[0]
    for i in range(1,N):
        ans=(ans+V[i])/2
    print(ans)
main()

Solution (Python):
import math;

def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def main():
    n = int(input())
    v = [x for x in map(int,input().split())]
    v.sort()
    ans = v[0]
    for i in range(1,n):
        ans = (ans+v[i])/2
    print(ans)
    return

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
v = [int(i) for i in input().split()]
sorted_v = sorted(v, reverse=True)
for i in range(n-1):
    x= sorted_v.pop()
    y = sorted_v.pop()
    sorted_v.append((x + y) / 2)
print(sorted_v[0])

Solution (Python):
from functools import reduce

n = int(input())
int_list = list(map(int, input().split()))
int_list.sort()


def avg(x, y):
    return (x+y)/2

print(reduce(avg, int_list))

Solution (Python):
N = int(input())
V = list(map(int, input().split()))


V = sorted(V)
result = V[0]
for i in range(1, N):
    result = (result + V[i]) / 2

print(result)

Solution (Python):
N = int(input())
li = list(map(int,input().split()))

li = sorted(li)
tmp = li[0]

for i in range(1,N):
  tmp = (tmp + li[i]) / 2

print(tmp)

Solution (Python):
N = int(input())
V = [float(i) for i in input().split()]

while len(V) > 1:
    list.sort(V)
    ave = (V[0] + V[1]) / 2
    V.pop(0)
    V.pop(0)
    V.append(ave)

print(V[0])

Solution (Python):
n = int(input())
v = list(map(int,input().split()))
v.sort()
v_average = []
v_average.append((v[0]+v[1]) / 2)
for i in range(2,n):
  v_average.append((v_average[-1]+v[i]) / 2)
print(v_average[-1])

Solution (Python):
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")


def main():
    N = int(input())
    V_1 = sorted(list(map(int, input().split())))
    logging.info("Hello!")

    total = V_1[0]
    
    for i in range(1, len(V_1)):
        total = (total + V_1[i]) / 2

    print(total)
    
    
if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
v = input().split()
for i in range(n):
	v[i] = int(v[i])
while(len(v) > 1):
	min1 = min(v)
	v.remove(min1)
	min2 = min(v)
	v.remove(min2)
	v.append((min1 + min2) / 2)
print(v[0])

Solution (Python):
import heapq
N = int(input())
V = list(map(int, input().split()))
heapq.heapify(V)


while len(V) > 1:
    x, y = heapq.heappop(V), heapq.heappop(V)
    heapq.heappush(V, (x + y) / 2)

print(V[0])

Solution (Python):
import heapq

N = int(input())
V = list(map(int, input().split()))
q = []
for v in V:
    heapq.heappush(q, v)

while len(q) > 1:
    x = (heapq.heappop(q) + heapq.heappop(q)) / 2
    heapq.heappush(q, x)

print(q[0])

Solution (Python):
n = input()
a = input().split(" ")
a = [int(b) for b in a]
a.sort()
while True:
    a = list(a)
    if len(a) <= 2:
        break
    c = a.pop(0)
    d = a.pop(0)
    synth = (c + d) / 2
    a.append(synth)
    a.sort()
print((a[0] + a[1]) / 2)

Solution (Python):
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    V = list(map(float, INPUT().split()))
    V.sort(reverse=True)

    for i in range(N-1):
        a = V.pop()
        b = V.pop()
        V.append((a + b)/2)

    print(V[0])


if __name__ == '__main__':
    main()

Solution (Python):
def f_c():
    n = int(input())
    v = sorted(list(map(int, input().split())))

    o = v[0]
    for i in range(1, n):
        o = (o+v[i])/2
    print(o)

if __name__ == "__main__":
    f_c()

Solution (Python):
n = int(input())
v = [int(i) for i in input().split()]
v.sort()
x = v[0]/2**(n-1)
for i in range(1,n):
    x += v[i]/2**(n-i)
print(x)

Solution (Python):
N = int(input())
v = list(map(float, input().split()))
v.sort()

otpt = v[0]
for i in range(1, len(v)):
  otpt = (v[i] + otpt) / 2

print(otpt)

Solution (Python):
N = int(input())
v_list = list(map(int, input().split()))
v_list = sorted(v_list)
for i in range(len(v_list)-1):
    v_list[i+1] = (v_list[i] + v_list[i+1]) / 2
print(v_list[-1])

Solution (Python):
n = int(input())
A = input().split()

M = [int(A[i]) for i in range(n)]
M.sort()
m = M[0]
for i in range(1,n):
  m = (m+M[i])/2
  
print(m)

Solution (Python):
n = int(input())
v = sorted(list(map(int, input().split())))

ans = 0
for i, vi in enumerate(v):
    if i==0:
        ans = v[i]
    else:
        ans = (ans + v[i]) / 2
        
print(ans)

Solution (Python):
N = int(input())
V = list(map(int,input().split(' ')))
L = sorted(V)
NUM = L[0]
for i in range(1,N):
  NUM = (L[i] + NUM) / 2

print(NUM)

Solution (Python):
n = int(input())
vs = sorted(list(map(int, input().split())))

result = vs[0]
for v in vs:
  result = (result + v) / 2

print(result)

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
v = na()
v = sorted(v)
a = v[0]
for i in range(1,n):
    a = (a+v[i])/2
print(a)

Solution (Python):
N = int(input())
v = list(map(int, input().split(" ")))
v.sort()
for i in range(N - 1):
    v[i + 1] = (v[i] + v[i + 1]) / 2

print(v[-1])

Solution (Python):
n = int(input())
Vs = list(map(float, input().split()))
Vs.sort()
ans=Vs[0]
for v in Vs[1:]:
  ans = (ans+v)/2.0
print(ans)

Solution (Python):
n = int(input())
v = list(map(int, input().split()))


v.sort()
ans = v[0]
for i in range(1,n):
    ans = (v[i] + ans)/2
print(ans)

Solution (Python):
N=input()
V=map(int, raw_input().split())
V.sort()

ans=None
for v in V:
	if ans is None:
		ans=v
	else:
		ans=float(ans+v)/2

print ans

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data)
if len(data) == 1:
    print(data[0])
else:
    while len(data) > 2:
        data.append(((data[0] + data[1]) / 2))
        data = sorted(data)
        data.remove(data[0])
        data.remove(data[1])
    print(sum(data)/2)

Solution (Python):



n = int(input())
arr = sorted(list(map(int, input().split())))

while len(arr) > 1:
  x = (arr[0] + arr[1])/2.0
  arr = [x] + arr[2:]
  arr = list(sorted(arr))

print(arr[0])

Solution (Python):
N = int(input())
v = list(map(int, input().split()))

def nabe(x,y):
    return (x + y) / 2


v = sorted(v)
for _ in range(N - 1):
    x = v.pop(0)
    y = v.pop(0)

    v.insert(0, nabe(x,y))

print(v[0])

Solution (Python):
N = int(input())
value = list(map(int,input().split()))
tval1 = 0
tval2 = 0


value = sorted(value)

for i in range(N-1):
  tval1 = value.pop(0)
  tval2 = value.pop(0)
  
  value.append((tval1+tval2)/2)
  value = sorted(value)

print(value[0])

Solution (Python):

from heapq import heappop,heappush
n = int(input())
A = list(map(int,input().split()))
h_queue = []
ans = 0
for i in range(n):
    heappush(h_queue,A[i])
for i in range(n-1):
    a1 = heappop(h_queue)
    a2 = heappop(h_queue)
    a3 = (a1+a2)/2
    heappush(h_queue,a3)

print(heappop(h_queue))

Solution (Python):
n = int(input())
v = [int(x) for x in input().split()]

v = sorted(v)

def r(s):
  rp = s[2:]
  rp.extend([(s[0] + s[1])/2])
  return rp

for _ in range(n-1):
  v = sorted(r(v))
  
print(v[0])

Solution (Python):
N = int(input())

v = list(map(int, input().split()))

v.sort()

while len(v) > 1:
    tmp = v[0] + v[1]
    del v[1]
    v[0] = tmp / 2
print(v[0])

Solution (Python):
import numpy as np
N = int(input())
v = np.array(list(map(float, input().split())))
v = np.sort(v)[::-1]
while len(v) > 1:
  v[-2] = (v[-2] + v[-1])*0.5
  v = np.delete(v, -1)
print(v[0])

Solution (Python):
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10


N = int(stdin.readline().rstrip())
v = [int(x) for x in stdin.readline().rstrip().split()]

x = 0
y = 0

while (True):
    minn = INF
    for i in range(len(v)):
        for j in range(i+1, len(v)):
            tmp = (v[i] + v[j]) / 2
            if minn > tmp:
                x = v[i]
                y = v[j]
                minn = tmp

    v.remove(x)
    v.remove(y)
    v.append(minn)
    
    if len(v) == 1:
        print(v[0])
        exit()

Solution (Python):
N = int(input())
List = list(map(int,input().split()))
A = 0
List = sorted(List)
for i in range(1,N):
    A += List[i]/2**(N-i)
print(A+List[0]/2**(N-1))

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
w=sorted(v)
for i in range(0,n-1):
    w[i+1]=(w[i]+w[i+1])/2
print(w[n-1])

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
Vs = sorted(V)
x=0
for i in range(N-1):
  if i == 0:
    x += (Vs[i] + Vs[i+1]) / 2 ** (N-i-1)
  else:
    x += (Vs[i+1]) / 2 ** (N-i-1)

print(x)

Solution (Python):



import sys
import re

n = input()
v = list(map(float, input().split()))
v = sorted(v, reverse=True)

def calc(v):
    if len(v) == 2:
        return sum(v) / 2
    else:
        return calc(v[:-2] + [((v[-2] + v[-1]) / 2)])

print(calc(v))

Solution (Python):

N = int(input())

v = sorted(list(map(int,input().split())))

for i, j in enumerate(range(N)):
    if i == 0:
        result = v[i]
    else:
        result = (result + v[i]) / 2

print(result)

Solution (Python):
N=int(input())
v=list(map(int,input().split()))

l_2=[2**0]
for i in range(N-1):
    l_2.append( 2**i )

s=0
for i in range(N):
    max2=l_2.pop(-1)
    maxv=v.pop(v.index(max(v)))
    s+=maxv*max2

ans=s/(2**(N-1))
print( int(ans) if ans.is_integer() else ans )

Solution (Python):
N = int(input())
v = [int(i) for i in input().split()]

v.sort()
a = int(v[0])
for i in range(N-1):
  a = (a+int(v[i+1]))/2.
print(a)

Solution (Python):
n=int(input())
x=list(map(int,input().split()))

y=sorted(x)

for i in range(n-1):
	z=(y[i]+y[i+1])/2
	y[i+1]=z

print(z)

Solution (Python):
N = int(input())
V = list(map(int,input().split()))
V = sorted(V)
ans = V[0]
for i in range(1,N) :
    ans = (ans + V[i]) / 2.0
print(ans)

Solution (Python):


def main():
    N = int(input())
    V = list(map(int, input().split()))
    V.sort()

    ans = V[0]
    for i in range(N-1):
        ans = (ans + V[i+1]) / 2
    return ans

if __name__ == '__main__':
    print(main())

Solution (Python):
N = int(input())
V = list(map(int,input().split()))
for  _ in range(N-1):
    V.sort()
    a = V.pop(0)
    b = V.pop(0)
    V.append((a+b)/2)
    V.sort()
print(V[0])

Solution (Python):
N=int(input())
v=list(map(int, input().split()))
u=sorted(v)

kachi=[0]*N
kachi[0]=u[0]

for i in range(1,N):
  kachi[i]=(kachi[i-1]+u[i])/2
  
print(kachi[N-1])

Solution (Python):
import heapq
N=int(input())
v=input().split()
q=[]
for i in range(N):
    heapq.heappush(q, int(v[i]))
while len(q)>1:
    a=heapq.heappop(q)
    b=heapq.heappop(q)
    heapq.heappush(q, (a+b)/2)
print(q[0])

Solution (Python):
N=int(input())
Val=list(map(int,input().split()))
V=sorted(Val, reverse=True)
value=[]
for i in range(N-1):
    v=V[i]/(2**(i+1))
    value.append(v)
last=V[N-1]/(2**(N-1))
value.append(last)
print(sum(value))

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
V.sort()
sum = V[0]
for i  in range(1,N):
    sum+=V[i]
    sum/=2
    i+=1
print(sum)

Solution (Python):
a = int(input())
la = list(map(int, input().split()))
la.sort()
for i in range(len(la)-1):
    la[i+1] = (la[i] + la[i+1])/2
print(la[-1])

Solution (Python):
n = int(input())
vl = sorted(list(map(int, input().split())))
maxv = vl[0]
for i in range(n - 1):
    maxv = (maxv + vl[i + 1]) / 2
print(maxv)

Solution (Python):
n = int(input())
v = list(map(int,input().split()))
x = sorted(v)
a = x[0]
for i in range(n-1):
    a = (a + x[i+1])/2
print(a)

Solution (Python):
n=input()
vlist= [int(x) for x in input().split()]
vlist.sort()
ans=vlist[0]
for v in vlist[0:]:
    ans=(ans+v)/2
print(ans)

Solution (Python):
N = int(input())
Vs = [int(i) for i in input().split()]
Vs.sort(reverse=True)

result = []

for i, v in enumerate(Vs):
    if i == N-1:
        result.append(v*(0.5)**(i))
    else:
        result.append(v*(0.5)**(i+1))

print(sum(result))

Solution (Python):
n = int(input())
v = sorted([int(x) for x in input().split()])
for i in range(n-1):
  v.append((v[0]+v[1])/2)
  del v[0:2]
  v = sorted(v)
print(v[0])

Solution (Python):
n = int(raw_input())
a = map(float, raw_input().split())

a.sort()
ans = sum(a[:2]) / 2
for i in xrange(2, n):
    ans = (ans + a[i]) / 2

print ans

Solution (Python):
N = int(input())
l = [int(i) for i in input().split()]
l.sort()
if N < 3:
    s = (l[0] + l[1]) / 2
else:
    s = (l[0] + l[1]) / 2
    for i in range(2, N):
        s = (s + l[i]) / 2
print(s)

Solution (Python):
n = int(input())
v_list = sorted(list(map(int, input().split())))


def cook(ary):
    if len(ary) == 1:
        return ary[0]

    new_v = (ary[0] + ary[1]) / 2
    new_ary = [new_v] + ary[2:]
    return cook(new_ary)

print(cook(v_list))

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()] 
C = 0.0
A.sort()

C = A[0]
for i in range(N-1):
	C = (C+A[i+1])/2
print(C)