#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
double n;
double d[((int)1e2 + 5)];
double dp[((int)1e2 + 5)][((int)1e2 + 5)];
double rec(int l, int r) {
  if (dp[l][r]) return dp[l][r];
  if (r - l == 1)
    return (d[l] + d[r]) / 2;
  else if (r == l)
    return d[l];
  double res = 0;
  for (int i = l; i < r; ++i) res = max(res, (rec(l, i) + rec(i + 1, r)) / 2);
  return dp[l][r] = res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> d[i];
  double ans = rec(0, n - 1);
  cout << fixed << ans << "\n";
}
