n=int(input())
v=list(map(int ,input().split()))
l=[]
draw_list=[]
second_draw=[]
for i in range(0,len(v)-1):
    first_combination=float((v[i]+v[i+1])/2)
    draw_list.append(first_combination)
    # print(draw_list)
for j in range(0,len(v)-1):
    second_combination=float((draw_list[j]+v[j])/2)
    second_draw.append(second_combination)
    # print(second_draw)

draw_list.extend(second_draw)
print(int(max(draw_list)))