#include <bits/stdc++.h>
using namespace std;
double v[64];
double cache[64][64];
double Solve(int a, int b) {
  if (cache[a][b] > 0) return cache[a][b];
  if (a == b) {
    return v[a];
  }
  double ans = 0;
  for (int k = a; k < b; ++k) {
    double t = (Solve(a, k) + Solve(k + 1, b)) / 2;
    if (t > ans) ans = t;
  }
  return cache[a][b] = ans;
}
int main() {
  int N;
  while (cin >> N) {
    memset(cache, 0, sizeof(cache));
    for (int i = 0; i < N; ++i) {
      cin >> v[i];
    }
    printf("%0.8f\n", Solve(0, N - 1));
  }
}
