#include <bits/stdc++.h>
using namespace std;
int n, r, LL[300005][28], RR[300005][28];
long long PP[28];
int A[300005];
pair<int, int> P[300005];
set<int> H;
set<int>::iterator it;
int L[300005][28], R[300005][28];
double res;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int i;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
    P[i].first = A[i];
    P[i].second = i;
  }
  sort(P + 1, P + n + 1);
  int N = 0;
  for (i = n; i >= 1; i--) {
    it = H.lower_bound(P[i].second);
    N = 0;
    while (it != H.end() && N <= 26) {
      R[P[i].second][++N] = *it;
      it++;
    }
    R[P[i].second][0] = N;
    it = H.lower_bound(P[i].second);
    N = 0;
    if (it != H.begin()) {
      it--;
      while (it != H.begin() && N <= 26) {
        L[P[i].second][++N] = *it;
        it--;
      }
      if (it == H.begin() && N <= 26) L[P[i].second][++N] = *it;
    }
    L[P[i].second][0] = N;
    H.insert(P[i].second);
  }
  PP[0] = 1;
  for (i = 1; i <= 26 + 1; i++) PP[i] = PP[i - 1] * 2;
  int j, k, l1, r1, l2, r2;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= L[i][0] && j <= 26; j++) {
      l1 = (j == 0) ? i : L[i][j];
      l2 = (j < L[i][0]) ? L[i][j + 1] : 0;
      LL[i][j] = l1 - l2 - 1;
    }
    for (k = 0; k <= R[i][0] && k <= 26; k++) {
      r1 = (k == 0) ? i : R[i][k];
      r2 = (k < R[i][0]) ? R[i][k + 1] : n + 1;
      RR[i][k] = r2 - r1 - 1;
    }
  }
  long long no[28];
  for (i = 1; i <= n; i++) {
    memset(no, 0, sizeof(no));
    for (j = 0; j <= L[i][0] && j <= 26; j++)
      for (k = 0; k <= R[i][0] && k <= 26 - j; k++)
        no[j + k] += (long long)LL[i][j] * RR[i][k] + LL[i][j] + RR[i][k] + 1;
    for (j = 0; j <= 26; j++) res += (double)A[i] * no[j] / PP[j + 1];
  }
  printf("%.10lf\n", (res / n) / n);
  return 0;
}
