#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int v[n + 1];
  for (int i = 1; i <= n; i++) cin >> v[i];
  double dp[n + 1][n + 1];
  for (int i = 1; i <= n; i++) dp[i][i] = v[i];
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 1; j + i <= n; j++) {
      int x = j;
      int y = j + i;
      double temp = 0;
      for (int k = 0; k < i; k++) {
        temp = max(temp, (dp[x][x + k] + dp[x + k + 1][y]) / 2);
      }
      dp[x][y] = temp;
    }
  }
  cout << setprecision(10);
  cout << dp[1][n];
}
