#include <bits/stdc++.h>
using namespace std;
const int K = 50;
const int N = 300000;
int n, pre[N + 10], nxt[N + 10];
set<int> s;
struct data {
  int va, loc;
} a[N + 10];
double ans = 0;
bool cmp(data p, data q) { return p.va > q.va; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].va);
    a[i].loc = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    set<int>::iterator nowloc = s.lower_bound(a[i].loc);
    if (nowloc == s.end())
      nxt[a[i].loc] = n + 1;
    else
      nxt[a[i].loc] = *nowloc;
    if (nowloc == s.begin())
      pre[a[i].loc] = 0;
    else {
      nowloc--;
      pre[a[i].loc] = *nowloc;
    }
    if (nxt[a[i].loc] != -1) pre[nxt[a[i].loc]] = a[i].loc;
    if (pre[a[i].loc] != -1) nxt[pre[a[i].loc]] = a[i].loc;
    double nowl = 0, px = 1.0;
    for (int now = a[i].loc, j = 0; j <= K && now != 0;
         j++, now = pre[now], px /= 2)
      nowl += px * (now - pre[now]);
    double nowr = 0;
    px = 1.0;
    for (int now = a[i].loc, j = 0; j <= K && now != n + 1;
         j++, now = nxt[now], px /= 2)
      nowr += px * (nxt[now] - now);
    ans += nowl * nowr / n / n * a[i].va;
    s.insert(a[i].loc);
  }
  printf("%.10lf\n", ans / 2);
  return 0;
}
