#include <bits/stdc++.h>
using namespace std;
const int MAXBUF = 1 << 23;
char B[MAXBUF], *Si = B, *Ti = B;
inline char getc() {
  if (Si == Ti) Ti = (Si = B) + fread(B, 1, MAXBUF, stdin);
  if (Si == Ti)
    return 0;
  else
    return *Si++;
}
template <class T>
inline void read(T &a) {
  static char c;
  static int fh;
  while (((c = getc()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    fh = -1, a = 0;
  else
    fh = 1, a = c - '0';
  while ((c = getc()) <= '9' && c >= '0') a = (a << 3) + (a << 1) + c - '0';
  if (fh == -1) a = -a;
}
char Buff[MAXBUF], *sti = Buff;
template <class T>
inline void write(T a) {
  if (a == 0) {
    *sti++ = '0';
    return;
  }
  if (a < 0) *sti++ = '-', a = -a;
  static char c[20];
  static int c0;
  c0 = 0;
  while (a) c[c0++] = a % 10 + '0', a /= 10;
  while (c0--) *sti++ = c[c0];
}
int a[1000005], n;
int pre[1000005], nxt[1000005];
int sl[85], sr[85], cl = 0, cr = 0;
int pl[85], pr[85];
double ans = 0.0;
struct node {
  int num, id;
} p[1000005];
inline bool cmp(node a, node b) {
  if (a.num != b.num) return a.num < b.num;
  return a.id < b.id;
}
int main() {
  int i, j;
  read(n);
  double orz = 0.5;
  orz /= ((double)(n));
  orz /= ((double)(n));
  nxt[0] = 1;
  pre[n + 1] = n;
  for (i = 1; i <= n; i++) {
    nxt[i] = i + 1;
    pre[i] = i - 1;
  }
  for (i = 1; i <= n; i++) {
    read(a[i]);
    p[i].num = a[i];
    p[i].id = i;
  }
  sort(p + 1, p + n + 1, cmp);
  for (i = 1; i <= n; i++) {
    cl = cr = 0;
    for (j = p[i].id; j != n + 1 && cr <= 80; j = nxt[j]) pr[++cr] = j;
    for (j = p[i].id; j && cl <= 80; j = pre[j]) pl[++cl] = j;
    pl[++cl] = 0;
    pr[++cr] = n + 1;
    pre[nxt[p[i].id]] = pre[p[i].id];
    nxt[pre[p[i].id]] = nxt[p[i].id];
    double c1 = 0.0, c2 = 0.0, tp = 1.0;
    for (j = 1; j < cl; j++) {
      sl[j] = pl[j] - pl[j + 1];
      c1 += 1.0 * sl[j] * tp;
      tp *= 0.5;
    }
    tp = 1.0;
    for (j = 1; j < cr; j++) {
      sr[j] = pr[j + 1] - pr[j];
      c2 += 1.0 * sr[j] * tp;
      tp *= 0.5;
    }
    double ovo = c1 * c2 * orz;
    ovo *= ((double)(p[i].num));
    ans += ovo;
  }
  printf("%.12lf\n", ans);
  return 0;
}
