#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int T = 100;
int rk[N], w[N], n;
int nxt[N], pre[N];
bool cmp(int x, int y) { return w[x] ^ w[y] ? w[x] < w[y] : x < y; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]), rk[i] = i;
  sort(rk + 1, rk + n + 1, cmp);
  for (int i = 1; i <= n; i++) nxt[i] = i + 1, pre[i] = i - 1;
  double ans = 0.0;
  for (int i = 1; i <= n; i++) {
    int x = rk[i], l = x, r = x;
    double lw = 0.0, rw = 0.0, coe = 1.0;
    for (int j = 1; j <= T; j++) {
      if (l) lw += coe * (l - pre[l]), l = pre[l];
      if (r <= n) rw += coe * (nxt[r] - r), r = nxt[r];
      coe *= 0.5;
    }
    ans += w[x] * lw * rw * 0.5;
    nxt[pre[x]] = nxt[x], pre[nxt[x]] = pre[x];
  }
  printf("%.12lf\n", ans / n / n);
  return 0;
}
