import std.stdio, std.conv, std.string, std.algorithm, std.range;
import std.functional;

double _f(int[] v, int l, int u)
{
  assert(0 <= l);
  assert(u < v.length);
  assert(l <= u);
  if (l == u)
    return v[l];
  return max((v[l] + f(v, l + 1, u)) / 2, (f(v, l, u - 1) + v[u]) / 2);
}

alias f = memoize!_f;
void main()
{
  auto N = readln.split[0].to!int;
  auto v = readln.split.to!(int[]);

  auto m = f(v, 0, N - 1);
  m.writeln;
}
