#include <bits/stdc++.h>
using namespace std;
const int c = 60;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  vector<long double> p2(c + 2);
  p2[0] = 1.;
  for (int i = 1; i <= c + 1; i++) p2[i] = p2[i - 1] / 2.;
  int n;
  cin >> n;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i;
  sort(a.begin(), a.end());
  long double ans = 0.;
  vector<int> nx(n), pv(n);
  for (int i = 0; i < n; i++) nx[i] = i + 1, pv[i] = i - 1;
  for (pair<int, int> p : a) {
    int i = p.second, val = p.first;
    vector<int> l, r;
    for (int j = i; j != -1 && l.size() < c; j = pv[j]) l.push_back(j);
    if (l.size() < c) l.push_back(-1);
    for (int j = i; j != n && r.size() < c; j = nx[j]) r.push_back(j);
    if (r.size() < c) r.push_back(n);
    long double suml = 0., sumr = 0.;
    for (int li = 0; li + 1 < l.size(); li++)
      suml += ((long double)(l[li] - l[li + 1])) * p2[li + 1];
    for (int ri = 0; ri + 1 < r.size(); ri++)
      sumr += ((long double)(r[ri + 1] - r[ri])) * p2[ri];
    ans += suml * sumr * (long double)val;
    if (pv[i] != -1) nx[pv[i]] = nx[i];
    if (nx[i] != n) pv[nx[i]] = pv[i];
  }
  ans /= n * 1. * n;
  cout << ans << "\n";
  return 0;
}
