#include <bits/stdc++.h>
using namespace std;
double max_val(const vector<double>& vals, vector<vector<double>>& dp, int l,
               int r) {
  if (l == r) {
    return vals[l];
  }
  if (dp[l][r] >= 0.0) {
    return dp[l][r];
  }
  double res = 0.0;
  for (int i = l; i < r; i++) {
    res =
        max(res, (max_val(vals, dp, l, i) + max_val(vals, dp, i + 1, r)) / 2.0);
  }
  return dp[l][r] = res;
}
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  vector<double> vals(n);
  for (int i = 0; i < n; i++) {
    cin >> vals[i];
  }
  vector<vector<double>> dp(n, vector<double>(n, -1));
  cout << setprecision(20) << max_val(vals, dp, 0, n - 1) << endl;
}
