#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 3e5 + 500;
const long long inf = 2e9;
long long a[maxn];
pair<long long, long long> b[maxn];
set<long long> st;
long long nxt[maxn];
long long pre[maxn];
void update(long long p) {
  set<long long>::iterator itnxt = st.lower_bound(p);
  set<long long>::iterator itpre = itnxt;
  itpre--;
  long long rnxt = (*itnxt);
  long long rpre = (*itpre);
  nxt[rpre] = p;
  pre[rnxt] = p;
  nxt[p] = rnxt;
  pre[p] = rpre;
  st.insert(p);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  st.insert(0);
  st.insert(n + 1);
  for (long long i = 0; i <= n + 1; i++) {
    nxt[i] = n + 1;
    pre[i] = 0;
  }
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = make_pair(a[i], i);
  }
  sort(b + 1, b + n + 1);
  reverse(b + 1, b + n + 1);
  long double ans = 0;
  for (long long i = 1; i <= n; i++) {
    long long v = b[i].second;
    update(v);
    vector<long long> vecnxt;
    vector<long long> vecpre;
    vecnxt.reserve(25);
    vecpre.reserve(25);
    long long p = v;
    while (p != n + 1 && vecnxt.size() < 25) {
      vecnxt.push_back(abs(nxt[p] - p));
      p = nxt[p];
    }
    p = v;
    while (p != 0 && vecpre.size() < 25) {
      vecpre.push_back(abs(p - pre[p]));
      p = pre[p];
    }
    long double z = 0.5;
    for (char j = 0; j < 25; j++) {
      long long r = 0;
      char tah = min((long long)j, (long long)vecpre.size() - 1);
      char sar = max((long long)0, j - (long long)vecnxt.size() + 1);
      for (char k = sar; k <= tah; k++) r += vecpre[k] * vecnxt[j - k];
      ans += a[v] * z * r;
      z /= 2;
    }
  }
  ans /= (n * n);
  cout << fixed << setprecision(10) << ans;
}
