#include <bits/stdc++.h>
using namespace std;
int n;
struct jsb {
  int a, b;
} data[310000];
inline bool cmp(const jsb &a, const jsb &b) { return a.a > b.a; }
double Pow[310000];
struct Info {
  double al, ar;
  int sum;
  inline Info operator+(const Info &b) const {
    Info c;
    c.al = c.ar = c.sum = 0;
    c.sum = b.sum + sum;
    c.al = al + b.al * Pow[sum];
    c.ar = b.ar + ar * Pow[b.sum];
    return c;
  }
} info[310000 * 4];
void add(int now, int l, int r, int x) {
  if (l == r) {
    info[now].sum = 1;
    info[now].al = info[now].ar = 0.5 * x;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid) add(now * 2, l, mid, x);
  if (x > mid) add(now * 2 + 1, mid + 1, r, x);
  info[now] = info[now * 2] + info[now * 2 + 1];
}
Info ask(int now, int l, int r, int x, int y) {
  if (x <= l && r <= y) return info[now];
  int mid = (l + r) >> 1;
  Info res;
  res.sum = 0;
  res.al = res.ar = 0;
  if (x <= mid) res = res + ask(now * 2, l, mid, x, y);
  if (y > mid) res = res + ask(now * 2 + 1, mid + 1, r, x, y);
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &data[i].a);
    data[i].b = i;
  }
  sort(data + 1, data + 1 + n, cmp);
  Pow[0] = 1;
  for (int i = 1; i <= n; i++) Pow[i] = Pow[i - 1] * 0.5;
  double res = 0;
  for (int i = 1; i <= n; i++) {
    add(1, 1, n, data[i].b);
    double lin, rin;
    Info l, r;
    if (data[i].b >= 2)
      l = ask(1, 1, n, 1, data[i].b - 1);
    else {
      l.sum = l.al = l.ar = 0;
    }
    if (data[i].b + 1 <= n)
      r = ask(1, 1, n, data[i].b + 1, n);
    else {
      r.sum = r.al = r.ar = 0;
    }
    l.ar = data[i].b - l.ar;
    r.al = r.al - data[i].b + Pow[r.sum] * (n + 1);
    res += 0.5 * l.ar * r.al * data[i].a;
  }
  printf("%.8lf\n", res / (1. * n * 1. * n));
  return 0;
}
