#include <bits/stdc++.h>
int inp() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum;
}
int a[300010], nxt[300010], pre[300010], id[300010];
bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  int n = inp();
  for (int i = 1; i <= n; i++) {
    a[i] = inp();
    id[i] = i;
  }
  std::sort(id + 1, id + n + 1, cmp);
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    pre[i] = i - 1;
    nxt[i] = i + 1;
  }
  nxt[n + 1] = n + 1;
  for (int p = 1; p <= n; p++) {
    int i = id[p];
    double cc = 1;
    int l = i;
    int r = i;
    double ls = 0, rs = 0;
    for (int T = 1; T <= 60; T++) {
      ls += cc * (double)(l - pre[l]);
      l = pre[l];
      rs += cc * (double)(nxt[r] - r);
      r = nxt[r];
      cc /= 2.0;
    }
    ans += ls * rs * (double)a[i] / 2;
    nxt[pre[i]] = nxt[i];
    pre[nxt[i]] = pre[i];
  }
  printf("%.10lf\n", ans / ((double)(n) * (double)(n)));
}
