#include <bits/stdc++.h>
using namespace std;
double x, y, z, s;
int n, a, b, c, v[300010], p[300010], l[300010], r[300010];
bool cmp(int x, int y) { return v[x] < v[y]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d", &v[i]), l[i] = i - 1, r[i] = i + 1, p[i] = i;
  sort(p + 1, p + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    x = y = 0, z = 1;
    a = b = c = p[i];
    for (int j = 1; j <= 45; j++) {
      if (a) x += (a - l[a]) * z, a = l[a];
      if (b <= n) y += (r[b] - b) * z, b = r[b];
      z /= 2;
    }
    l[r[c]] = l[c], r[l[c]] = r[c];
    s += x * y * v[c] / 2;
  }
  printf("%.6f\n", s / n / n);
  return 0;
}
