#include <bits/stdc++.h>
using namespace std;
namespace io {
inline void readl(long long &x) {
  x = 0;
  long long f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
inline void read(int &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
}  // namespace io
using namespace io;
int n;
double a[105], f[105][105];
int main() {
  read(n);
  for (register int i = 1; i <= n; i++) scanf("%lf", &a[i]), f[i][i] = a[i];
  for (register int x = 1; x <= n; x++) {
    for (register int i = 1; i + x - 1 <= n; i++) {
      int j = i + x - 1;
      for (register int k = i; k < j; k++) {
        f[i][j] = max(f[i][j], (f[i][k] + f[k + 1][j]) / 2.0);
      }
    }
  }
  printf("%lf", f[1][n]);
  return 0;
}
