#include <bits/stdc++.h>
using namespace std;
int reader_pt = 1048576, reader_last;
char reader_buf[1048576];
int reader_nonneg_int() {
  int r;
  for (;;) {
    if (reader_pt == 1048576)
      reader_pt = 0,
      reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
    if (('0' <= (reader_buf[reader_pt]) && (reader_buf[reader_pt]) <= '9'))
      break;
    reader_pt++;
  }
  r = reader_buf[reader_pt++] - '0';
  for (;;) {
    if (reader_pt == 1048576)
      reader_pt = 0,
      reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
    if (!('0' <= (reader_buf[reader_pt]) && (reader_buf[reader_pt]) <= '9'))
      break;
    r = r * 10 + (reader_buf[reader_pt++] - '0');
  }
  reader_pt++;
  return r;
}
double solve_brute(int n, int in[]) {
  int i, j, k, s;
  int arr[100];
  double res = 0, tmp;
  for (i = 0; i < n; i++)
    for (j = i; j < n; j++) {
      s = 0;
      for (k = i; k < j + 1; k++) arr[s++] = in[k];
      tmp = 0;
      sort(arr, arr + s);
      for (k = 0; k < s; k++) tmp = (tmp + arr[k]) / 2;
      res += tmp;
    }
  res /= n;
  res /= n;
  return res;
}
int main() {
  int i, j, k, kk, l, m, n, x, y;
  static int a[500000];
  static pair<int, int> srt[500000];
  set<int> ind;
  set<int>::iterator it, it1, it2;
  int ss[25], ls[25];
  double pw[100], res;
  pw[0] = 1;
  for (i = 1; i < 100; i++) pw[i] = pw[i - 1] * 0.5;
  n = reader_nonneg_int();
  for (i = 0; i < n; i++) a[i] = reader_nonneg_int();
  for (i = 0; i < n; i++) srt[i] = make_pair(a[i], i);
  sort(srt, srt + n);
  res = 0;
  ind.clear();
  ind.insert(-1);
  ind.insert(n);
  for (kk = n - 1; kk >= 0; kk--) {
    k = srt[kk].second;
    ind.insert(k);
    it = ind.lower_bound(k);
    it1 = it2 = it;
    for (i = 0; i < 25; i++) ss[i] = ls[i] = 0;
    x = 0;
    for (i = 0; i < 25; i++) {
      it1--;
      y = ss[i] = k - (*it1);
      ss[i] -= x;
      x = y;
      if ((*it1) == -1) break;
    }
    x = 0;
    for (i = 0; i < 25; i++) {
      it2++;
      y = ls[i] = (*it2) - k;
      ls[i] -= x;
      x = y;
      if ((*it2) == n) break;
    }
    for (i = 0; i < 25; i++)
      if (ss[i])
        for (j = 0; j < 25; j++)
          if (ls[j]) {
            res += pw[i + j + 1] * a[k] * ss[i] * ls[j];
          }
  }
  res /= n;
  res /= n;
  printf("%.15f\n", res);
  return 0;
}
