#include <bits/stdc++.h>
using namespace std;
int cmp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first != b.first)
    return a.first > b.first;
  else
    return a.second < b.second;
}
double sv[32 + 10], lenl[32 + 10], lenr[32 + 10], lv[32 + 10], rv[32 + 10];
int a[300010];
pair<int, int> d[300010];
void lemon() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]);
  for (int i = (1); i <= (n); i++) d[i] = make_pair(a[i], i);
  sort(d + 1, d + n + 1, cmp);
  set<int> s;
  double final = 0;
  for (int i = (1); i <= (n); i++) {
    sv[0] = d[i].first;
    for (int k = (1); k <= (32 + 1); k++) sv[k] = sv[k - 1] / 2;
    pair<set<int>::iterator, bool> rrr = s.insert(d[i].second);
    set<int>::iterator it = rrr.first;
    set<int>::iterator it2 = it;
    int ra = 0, la = 0;
    rv[0] = d[i].second;
    lv[0] = d[i].second;
    for (int k = (1); k <= (32); k++) {
      it++;
      if (it == s.end()) {
        ra++;
        rv[ra] = n + 1;
        break;
      }
      ra++;
      rv[ra] = (*it);
    }
    it = it2;
    for (int k = (1); k <= (32); k++) {
      if (it == s.begin()) {
        la++;
        lv[la] = 0;
        break;
      }
      it--;
      la++;
      lv[la] = (*it);
    }
    for (int k = (1); k <= (ra); k++) lenr[k - 1] = rv[k] - rv[k - 1];
    for (int k = (1); k <= (la); k++) lenl[k - 1] = lv[k - 1] - lv[k];
    for (int kl = (0); kl <= (la - 1); kl++)
      for (int kr = (0); kr <= (min(32 - kl - 1, ra - 1)); kr++)
        final += sv[kl + kr + 1] * lenl[kl] * lenr[kr];
  }
  final /= n;
  final /= n;
  printf("%.16lf\n", final);
}
int main() {
  ios::sync_with_stdio(true);
  lemon();
  return 0;
}
