#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<double>> dp(n, vector<double>(n, -1));
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  function<double(int, int)> rec = [&](int l, int r) -> double {
    if (l == r) return arr[l];
    double& ret = dp[l][r];
    if (ret != -1) return ret;
    for (int i = l; i < r; i++) {
      ret = max(ret, (rec(l, i) + rec(i + 1, r)) / 2.0);
    }
    return ret;
  };
  cout << rec(0, n - 1) << '\n';
  return (0);
}
