#include <bits/stdc++.h>
using namespace std;
double dp[55][55];
double arr[55];
int vis[55][55];
double fun(int i, int j) {
  if (i == j) return arr[i];
  if (vis[i][j] != -1) return dp[i][j];
  vis[i][j] = 1;
  double ans = INT_MIN;
  for (int k = i; k < j; k++) {
    ans = max(ans, (fun(i, k) + fun(k + 1, j)) / 2);
  }
  return dp[i][j] = ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(vis, -1, sizeof(vis));
  printf("%.9f\n", fun(0, n - 1));
}
