#include <bits/stdc++.h>
using namespace std;
const int N = 50;
double max(double a, double b) { return a > b ? a : b; }
int main() {
  int n, array[N];
  double cost[N][N] = {};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> array[i];
    cost[0][i] = array[i];
  }
  for (int l = 2; l < n + 1; l++) {
    for (int i = 0; i < n - l + 1; i++) {
      for (int k = 0; k < l - 1; k++) {
        cost[l - 1][i] =
            max(cost[l - 1][i], (cost[k][i] + cost[l - k - 2][i + k + 1]) / 2);
      }
    }
  }
  cout << cost[n - 1][0] << endl;
}
