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