#include <bits/stdc++.h>
using std::max;
const int maxn = 55;
double dp[maxn][maxn];
double val[maxn];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf", &val[i]), dp[i][i] = val[i];
  for (int i = 1; i < n; i++) {
    for (int j = 1; j + i <= n; j++) {
      for (int k = j; k < i + j; k++) {
        dp[j][i + j] = max(dp[j][i + j], (dp[j][k] + dp[k + 1][i + j]) / 2);
      }
    }
  }
  printf("%lf", dp[1][n]);
  return 0;
}
