using System;
using System.Linq;

namespace atcoderbc138
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            double[] A = Console.ReadLine().Split().Select(double.Parse).ToArray();
            double[,] dp = new double[50, 50];
            for (int i = 0; i < 50; ++i)
                for (int j = 0; j < 50; ++j)
                    dp[i, j] = -1;
            Console.WriteLine(Best(0, A.Length - 1, A, dp));
        }


        static double Best(int i, int j, double[] A, double[,] dp)
        {
            if (i == j)
                return A[i];

            if (dp[i, j] != -1)
                return dp[i, j];

            double sl = 0;
            for (int l = i; l <= j - 1; ++l)
            {
                double rs = (Best(i, l, A, dp) + Best(l + 1, j, A, dp)) / 2.0;
                if (rs - sl > 1e-5)
                    sl = rs;
            }
            dp[i, j] = sl;
            return sl;
        }
    }
}
