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

ma = sum(a) / len(a)

a.sort()
l = 0
u = len(a)-1
for i in range(len(a)):
    if a[i] <= ma and a[l] <= a[i]:
        l = i
    if a[i] >= ma and a[u] >= a[i]:
        u = i

print(a[l])
print(a[u])
print(ma)

if (ma - a[l]) <= (a[u] - ma):
    print(a[l])
else:
    print(a[u])

