import numpy as np

n = int(input())
a = str(input())
array = [int(s) for s in a.split()]
sum = 0
difference = 0
index = 0

avarage = np.average(array)

for i, a in enumerate(array):
    tmp_diff = abs(a-avarage)
    if i == 0:
        difference = tmp_diff
        index = 0
    else:
        if difference > tmp_diff:
            difference = tmp_diff
            index = i

print(array[index])