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 = int(input())
slist = list(map(int, input().split()))


score=0
while len(slist)>=2:
	m1 = min(slist)
	slist.remove(m1)
	m2 = min(slist)
	slist.remove(m2)

	slist.append((m1+m2)/2)


print(slist[0])

Solution (Python):
import functools


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


def main():
    n = int(input())
    v = [int(x) for x in input().split()]

    v.sort()
    max_value = functools.reduce(new_ingredient, v)

    print(max_value)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
v.sort()
while True:
    x=v.pop(0)
    y=v.pop(0)
    v.append((x+y)/2)
    v.sort()
    if len(v)==1:
        break
print(v[0])

Solution (Python):


import sys














def main():
    mod = 10000007                  
    inf = float('inf')
    input = sys.stdin.readline      
    sys.setrecursionlimit(10**6)    
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())
    
    
    n = ii()
    v = sorted(lmi())
    ans = (v[0] + v[1]) / 2
    for i in range(2, n):
        ans = (ans + v[i]) / 2
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect



import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial, log, log10, log2
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n = int(readline())
  v = list(map(int, readline().split()))
  v.sort()
  total = 0
  for i in range(n):
    if i == 0:
      total += v[i]
    else:
      total += (2**(i-1))*v[i]
  print(total/(2**(n-1)))
  
  
  
if __name__ == '__main__':
  main()

Solution (Python):

n = int(input())
v = [int(i) for i in input().split()]

v.sort()
while len(v) > 1:
    tmp1 = v.pop(0)
    tmp2 = v.pop(0)
    v.append((tmp1 + tmp2) / 2)
    v.sort()
print(v[0])

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
v = LIST()
v.sort()
v = deque(v)
for i in range(n - 1):
    v1 = v.popleft()
    v2 = v.popleft()
    v.appendleft((v1 + v2) / 2)
print(v[0])

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

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

print(ans)

Solution (Python):
import heapq
N = int(input())
H = list(map(int, input().split()))
heapq.heapify(H)
while len(H) >= 2:
  f = heapq.heappop(H)
  s = heapq.heappop(H)
  heapq.heappush(H, (f + s) / 2)
print(H[0])

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
V = sorted(iil())

ans = V[0]

for i in V:
    ans = (ans+i)/2

print(ans)

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

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

for i in range(n-1):
  temp = (v[n-1-i] +v[n-2-i])/2
  v.pop()
  v.pop()
  v.append(temp)
  
print(v[0])

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

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


vl.sort()

ans=vl[0]
for i in range(1,n):
    ans=(ans+vl[i])/2

print('{:.9f}'.format(ans))

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

Solution (Python):

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

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

v.sort()
for i in range(n-1):
   a = v.pop(0)
   b = v.pop(0)
   v.append((a+b) / 2)
   v.sort()
print(v[0])

Solution (Python):
from heapq import *
n = int(input())
v = list(map(int, input().split()))
heapify(v)
for i in range(n-1):
    a = heappop(v)
    b = heappop(v)
    heappush(v, (a+b)/2)
print(heappop(v))

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

v.sort(reverse=True)
for i in range(N-1):
    value = (v.pop() + v.pop()) / 2
    v.append(value)

print(v[0])

Solution (Python):
import heapq

N = int(input())
v = list(map(float, input().split(" ")))
heapq.heapify(v)

while len(v) > 1:
  a, b = heapq.heappop(v), heapq.heappop(v)
  heapq.heappush(v, (a + b) / 2)
print(heapq.heappop(v))

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

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

V = sorted(V)

for i in range(n-1):
  V[0] = (V[0] + V[1]) / 2
  del V[1]

print(V[0])

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
import heapq

def main():
    N = int(input())
    V = input_nums()
    heapq.heapify(V)
    while len(V) > 1:
        a = heapq.heappop(V)
        b = heapq.heappop(V)
        total = (a+b)/2
        heapq.heappush(V, total)
    print(heapq.heappop(V))

if __name__ == '__main__':
    main()

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

Solution (Python):
_ = input()
*v, = map(int, input().split())
v.sort()
while len(v)>=2:
    v = [(v[0]+v[1])/2] + v[2:]
print(v[0])

Solution (Python):
import heapq
n = int(input())
vlist = list(map(int,input().split()))
heapq.heapify(vlist)
while len(vlist) > 1:
  a = (heapq.heappop(vlist) + heapq.heappop(vlist)) / 2
  heapq.heappush(vlist,a)
print(vlist[0])

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

def f(v):
    
    if len(v) == 1:
        print("".join(map(str,v)))
    else:
        v.sort()
        a = v.pop(0)
        b = v.pop(0)
        v.append(((a+b)/2))
        f(v)

f(v)

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())
v = list(map(int, input().split()))

v.sort()

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

for i in range(n-2):
    ans = (ans + v[i+2]) /2

print(ans)

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

v_list.sort()

rest = (v_list[0] + v_list[1]) / 2

for i in range(len(v_list)-2):
    rest = (rest + v_list[i+2]) / 2

print(rest)

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

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

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

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

Solution (Python):
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
  
print(ans)

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

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

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

print(ans)

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

v.sort()
for i in range(n-1):
   a = v.pop(0)
   b = v.pop(0)
   v.append((a+b) / 2)
   v.sort()
print(v[0])

Solution (Python):
import sys
import numpy as np

n=int(sys.stdin.readline())
v=np.array(sys.stdin.readline().split(),dtype='int64')
v=np.sort(v)


for i in range(n):
    if i==0:
        ans=v[i]/(2**(n-i-1))
    else:
        ans+=v[i]/(2**(n-i))

print(ans)

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

Solution (Python):
import math

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

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

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

lst=sorted(lst, reverse=True)
new=[lst[i]*(1/2)**(i+1) for i in range(n-1)]
print(sum(new)+lst[-1]*(1/2)**(n-1))

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

Solution (Python):
n = int(input()) 
v = list(map(int,(input().split()))) 
sum_now = 0
sum_old = 0
v.sort()

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

Solution (Python):

"""
Created on Wed Mar 25 15:11:59 2020

@author: Kanaru Sato
"""

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

v.sort()
valuesum = (v[0]+v[1])/2

for i in range(2,n):
    valuesum = (valuesum+v[i])/2

print(valuesum)

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

v.sort(reverse = True)

for i in range(n):
  if len(v) > 1:
    a = v.pop()
    b = v.pop()
    v.append((a + b) / 2)
print(v[0])

Solution (Python):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    V = list(map(int, sys.stdin.buffer.readline().split()))
    V.sort()

    for n in range(N-1):
        V[n+1] = (V[n] + V[n+1])/2

    print(V[N-1])


if __name__ == '__main__':
    main()

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

while len(v)>1:
    g1, g2 = v[0], v[1]
    g = (g1+g2)/2
    v = [g]+ v[2:]
    v = sorted(v)

print(v[0])

Solution (Python):
import sys
import math

from collections import defaultdict
from collections import deque
import heapq
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s

n = load()
v = load_list()

heapq.heapify(v)
while len(v) > 1:
    e1 = heapq.heappop(v)
    e2 = heapq.heappop(v)
    heapq.heappush(v, (e1+e2)/2.0)

print(heapq.heappop(v))

Solution (Python):
import sys
input = sys.stdin.readline

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

    ans = v[0]
    for x in v[1:]:
        ans = (ans + x) / 2

    print(ans)


if __name__ == "__main__":
    main()

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

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

main()

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):

import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    v = [int(x) for x in input().split()]

    v = sorted(v)

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

    print(ans)



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.0

print(ans)

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

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

V = sorted(V)

ans = V[0]

for v in V[1:]:
  ans += v
  ans /=2.0
  
print(ans)

Solution (Python):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))


N = ir()
V = np.array(lr())
V.sort()
coef = [.5 ** x for x in range(1, N+1)]
coef.reverse()
coef[0] = coef[1]
coef = np.array(coef)
answer = (V * coef).sum()
print('{:.10f}'.format(answer))

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

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

sum = 0
p = -1 * (n - 1) 
for i in range(n):
    if i == 0:
        sum += v[i] * 2**p
    else:
        sum += v[i] * 2**p
        p += 1

print(sum)

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

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

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

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

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

v.sort()

res = v[0]/(2**(n-1))

for i in range(1,n):
  res += v[i]/(2**(n-i))

print(res)

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

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

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):
import numpy as np
n = int(input())
v = list(map(int,input().split()))
while n > 1:
    temp = np.sum(sorted(v)[:2])/2
    v = sorted(v)[2:]
    v.append(temp)
    n -= 1
print(temp)

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

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

print(m)

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

while len(v) > 1:
  v = sorted(v)
  v1 = v.pop(0)
  v2 = v.pop(0)
  v.append((v1+v2)/2)
print(v[0])

Solution (Python):
N=int(input())
v=[int(i) for i in 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):








def resolve():
    N=int(input())
    V=sorted(list(map(int,input().split())))

    while True:
        V[1]=(V[0]+V[1])/2
        V.pop(0)
        if len(V)==1:
            print(V[0])
            break


resolve()

Solution (Python):

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

Solution (Python):
def solve(N, values):
    while len(values) > 1:
        values.sort()
        x = values.pop(0)
        y = values.pop(0)
        values.append((x + y) / 2)
    return values[0]


N = int(input())
values = [int(v) for v in input().split()]
ans = solve(N, values)
print(ans)

Solution (Python):

import heapq
n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)

for _ in range(n-1):
    x = heapq.heappop(v)
    y = heapq.heappop(v)
    heapq.heappush(v, (x+y)/2)
print(heapq.heappop(v))

Solution (Python):












n = int(input())
arrA = list(map(int,input().split()))

while len(arrA)>1:
    arrA.sort(reverse = True)
    num = (arrA.pop() + arrA.pop()) / 2
    arrA.append(num)

print(*arrA)

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

for _ in range(n - 1):
    v.sort(reverse=1)
    a = v.pop() + v.pop()
    v.append(a / 2)
print(v[0])

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

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

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

li.sort()

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

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

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

print(ans)

Solution (Python):
N = int(input())
V = sorted([int(x) for x in input().split()])
res = 0
for i in range(N):
    if i == 0:
        res += V[i]
    else:
        res = (res + V[i])/2
print(res)

Solution (Python):
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)
u = []
a = 1

u.append(1/2)
u.append(1/2)

for i in range(n-2):
    if n != 2:
        a = u.pop(-1)/2
        u.append(a)
        u.append(a)

u = sorted(u)

s = 0
for i in range(len(v)):
	s += v[i]*u[i]
         
print(s)

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

Solution (Python):

"""
C - Alchemist
https://atcoder.jp/contests/abc138/tasks/abc138_c

"""
import sys


def solve(N, values):
    while len(values) > 1:
        values.sort()
        x = values.pop(0)
        y = values.pop(0)
        values.append((x + y) / 2)
    return values[0]


def main(args):
    N = int(input())
    values = [int(v) for v in input().split()]
    ans = solve(N, values)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

Solution (Python):
import heapq
N = int(input())
V = [int(x) for x in input().split()]
heapq.heapify(V)

nabe = 0
for n in range(N-1):
    a = heapq.heappop(V)
    a += heapq.heappop(V)
    nabe += a
    heapq.heappush(V, a / 2)

print(V[0])

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

for i in range(n):
    min1=v.pop(v.index(min(v)))
    min2=v.pop(v.index(min(v)))
    new=(min1+min2)/2
    v.append(new)
    if len(v)==1:
        print(new)
        exit()

Solution (Python):
import sys


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

if __name__ == '__main__':
    main()

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

Solution (Python):
_ = input()
_v, *v = sorted(map(int, input().split()))
for i in v:
    _v = (_v + i) / 2
print(_v)

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

Solution (Python):


n = int(input().rstrip())

guzai = list(sorted(map(int, input().rstrip().split(" "))))

ans = guzai[0]

for i in range(1, n):
    ans = (ans + guzai[i]) / 2

print(ans)

Solution (Python):
from functools import reduce

n = int(input())
v = sorted(list(map(float, input().split())))
print(reduce(lambda x, y: (x + y) / 2, v))

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

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

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

    return ans

print(solve())

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

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

v.sort()
while(True):
    if len(v) == 1:
        break
    else:
        x = v.pop(0)
        y = v.pop(0)
        v.append((x+y)/2)
        v.sort()

print(v[0])

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

while len(v) > 1:
    l = v.pop(0)
    r = v.pop(0)
    t = (l+r)/2
    bisect.insort(v,t)
print(v[0])

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

v_r = sorted(v)
result = 0
tmp = (v_r[0] + v_r[1]) / 2
for i in range(2,N):
    
    tmp = (tmp + v_r[i]) / 2
print(tmp)

Solution (Python):

N = int(input())

A = list(map(int,input().split()))
A = sorted(A)
ans = 0
for i in range(N):
    if i == 0:
        ans += (A[i]+A[i+1])/2
    elif i<N-1:
        ans = (ans+A[i+1])/2
print(ans)

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

Solution (Python):
import heapq
n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)
for i in range(n-1):
    v1 = heapq.heappop(v)
    v2 = heapq.heappop(v)
    heapq.heappush(v, (v1+v2)/2)
print(v[0])

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

material = v[0]
for x in range(N - 1):
    material = (material + v[x+1]) / 2
print(material)

Solution (Python):
input()
l=sorted(map(int,input().split()))
a=l.pop(0)
for i in l: a=(a+i)/2
print(a)

Solution (Python):
n=int(input())
l=sorted(map(int,input().split()))[::-1]
print(sum(l[i]*.5**-~i for i in range(n))+l[-1]*.5**n)

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

Solution (Python):
from functools import reduce

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

V.sort()
print(reduce(lambda a, b: (a + b) / 2, V))

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

res = v[0]

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

print(res)

Solution (Python):

def submit():
    n = int(input())
    vlist = list(map(int, input().split()))
    
    curr_n = n
    while curr_n > 1:
        merge = (0, 0)
        max_sum = 0
        curr_sum = sum(vlist)
        for i in range(curr_n):
            for j in range(i + 1, curr_n):
                merge_sum = curr_sum - vlist[i] - vlist[j] + \
                            (vlist[i] + vlist[j]) / 2
                if max_sum < merge_sum:
                    max_sum = merge_sum
                    merge = (i, j)
                
        avg = (vlist[merge[0]] + vlist[merge[1]]) / 2
        vlist.pop(merge[0])
        vlist.pop(merge[1] - 1)
        vlist.append(avg)
        curr_n -= 1

    print(vlist[0])


if __name__ == "__main__":
    submit()

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

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

Solution (Python):
n=int(input())
v=sorted(list(map(int,input().split())))
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.sort()

while len(V) > 1:
    tmp = sum(V[:2]) / 2
    V = V[2:] + [tmp]
    V.sort()

print(V[0])

Solution (Python):



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


v_list = sorted(v_list)
ans_list = [0]*(N+1)
ans_list[0] = v_list[0]


for i in range(N):
    ans_list[i+1] = (ans_list[i] + v_list[i])/2


print(ans_list[N])

Solution (Python):

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

ans=v[0]
def heikin(x,y):
    return (x+y)/2

for i in range(1,n):
    ans=heikin(ans,v[i])
print(ans)

Solution (Python):
import math
import bisect
import heapq
from collections import deque

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

v.sort()
heapq.heapify(v)

for _ in range(n-1):
    x = heapq.heappop(v)
    y = heapq.heappop(v)
    heapq.heappush(v, (x+y)/2.)

ans = heapq.heappop(v)
print(ans)

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

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

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.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())
V = list(map(int, input().split()))
V.sort()
for i in range(N-1):
  V[1] = (V[0]+V[1])/2
  V.pop(0)
print(V[0])

Solution (Python):
n=int(input())
v=list(map(float,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.sort()
ans = v[0]
for i in range(1, N):
    ans = (v[i] + ans) / 2
print(ans)

Solution (Python):
import heapq

N = int(input())
V = [int(a) for a in input().split()]
h = []
for v in V:
    heapq.heappush(h, v)

for i in range(N-1):
    heapq.heappush(h, (heapq.heappop(h) + heapq.heappop(h)) / 2)

print(heapq.heappop(h))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

print(com)