#include <bits/stdc++.h>
using namespace std;
int n, i, j, p, b[310000], tx[310000];
double ans, pia[310000], sum[410000], mu[410000];
struct aa {
  double mul, sum;
  aa operator+(aa b) {
    aa c;
    c.mul = mul * b.mul;
    c.sum = sum + mul * b.sum;
    return c;
  }
} s[1210000];
bool cmp(int x, int y) {
  if (b[x] != b[y]) return b[x] > b[y];
  return x < y;
}
aa get(int k, int q, int h, int l, int r) {
  if (l <= q && h <= r) return s[k];
  if (r <= (q + h) / 2) return get(k * 2, q, (q + h) / 2, l, r);
  if ((q + h) / 2 < l) return get(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
  return get(k * 2, q, (q + h) / 2, l, r) +
         get(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
}
void modify(int k, int q, int h, int x) {
  if (q == h) {
    s[k].mul /= 2;
    s[k].sum /= 2;
  } else {
    if (x <= (q + h) / 2)
      modify(k * 2, q, (q + h) / 2, x);
    else
      modify(k * 2 + 1, (q + h) / 2 + 1, h, x);
    s[k] = s[k * 2] + s[k * 2 + 1];
  }
}
void mkt(int k, int q, int h) {
  if (q < h) {
    mkt(k * 2, q, (q + h) / 2);
    mkt(k * 2 + 1, (q + h) / 2 + 1, h);
    s[k] = s[k * 2] + s[k * 2 + 1];
  } else
    s[k].mul = 1, s[k].sum = 0.5;
}
void downdate(int k, int l) {
  sum[k] *= mu[k];
  if (l > 1) {
    mu[k * 2] *= mu[k];
    mu[k * 2 + 1] *= mu[k];
  }
  mu[k] = 1;
}
void mul(int k, int q, int h, int l, int r) {
  downdate(k, h - q + 1);
  if (l <= q && h <= r)
    mu[k] /= 2;
  else {
    if (r <= (q + h) / 2)
      mul(k * 2, q, (q + h) / 2, l, r);
    else if ((q + h) / 2 < l)
      mul(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
    else
      mul(k * 2, q, (q + h) / 2, l, r),
          mul(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
    sum[k] = sum[k * 2] * mu[k * 2] + sum[k * 2 + 1] * mu[k * 2 + 1];
  }
}
void inc(int k, int q, int h, int x, double y) {
  downdate(k, h - q + 1);
  if (q == h)
    sum[k] += y;
  else {
    if (x <= (q + h) / 2)
      inc(k * 2, q, (q + h) / 2, x, y);
    else
      inc(k * 2 + 1, (q + h) / 2 + 1, h, x, y);
    sum[k] = sum[k * 2] * mu[k * 2] + sum[k * 2 + 1] * mu[k * 2 + 1];
  }
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= n; i++) tx[i] = i;
  sort(tx + 1, tx + n + 1, cmp);
  mkt(1, 1, n);
  for (i = 1; i <= n; i++) {
    pia[tx[i]] = get(1, 1, n, tx[i], n).sum;
    modify(1, 1, n, tx[i]);
  }
  for (i = n; i; i--) {
    mul(1, 1, 100000, 1, b[i]);
    inc(1, 1, 100000, b[i], b[i] * pia[i]);
    ans += sum[1] * mu[1];
  }
  printf("%.10lf\n", ans / n / n);
}
