#include <bits/stdc++.h>
using namespace std;
vector<double> a;
bool done[50][50];
double memo[50][50];
double solve(int l, int r) {
  if (l == r) return a[l];
  double &ret = memo[l][r];
  if (!done[l][r]) {
    for (int i = l; i < r; ++i) {
      double x = (solve(l, i) + solve(i + 1, r)) / 2.0;
      if (i == l)
        ret = x;
      else
        ret = max(ret, x);
    }
    done[l][r] = true;
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0, aux; i < n; ++i) {
    cin >> aux;
    a.push_back(aux);
  }
  memset(done, false, sizeof done);
  printf("%.10f\n", solve(0, n - 1));
  return 0;
}
