#include <bits/stdc++.h>
double v[50];
using namespace std;
double dp[50][50];
double solve(int start, int end) {
  if (start == end) return v[start];
  if (dp[start][end] > -1) return dp[start][end];
  double res = 0;
  for (int i = start; i < end; i++) {
    res = max(res, (solve(start, i) + solve(i + 1, end)) / 2);
  }
  dp[start][end] = res;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < 50; i++) {
    for (int j = 0; j < 50; j++) {
      dp[i][j] = -1;
    }
  }
  int n;
  cin >> n;
  for (auto &e : v) cin >> e;
  cout << setprecision(10) << solve(0, n - 1);
  return 0;
}
