#include <bits/stdc++.h>
using namespace std;
struct SegmentTreeDivideRange {
  int size;
  int treeSize;
  vector<double> SUM;
  vector<int> LAZY;
  SegmentTreeDivideRange(int sz) {
    size = sz;
    treeSize = 4 * sz;
    SUM.resize(treeSize);
    LAZY.resize(treeSize);
  }
  void push(int x, int l, int r) {
    if (l < r) {
      LAZY[x + x] += LAZY[x];
      LAZY[x + x + 1] += LAZY[x];
    }
    apply(x);
  }
  inline void apply(int x) {
    const int M = 60;
    int k = LAZY[x];
    if (k >= M + M)
      SUM[x] = 0;
    else {
      while (k >= M) {
        SUM[x] /= (1LL << M);
        k -= M;
      }
      SUM[x] /= (1LL << k);
    }
    LAZY[x] = 0;
  }
  void UpdateOne(int pp, double val) { UpdateOne(1, 0, size - 1, pp, val); }
  void UpdateOne(int x, int l, int r, int pp, double val) {
    push(x, l, r);
    if (l > pp || r < pp) return;
    if (l == r) {
      SUM[x] += val;
      push(x, l, r);
      return;
    }
    int y = (l + r) >> 1;
    UpdateOne(x + x, l, y, pp, val);
    UpdateOne(x + x + 1, y + 1, r, pp, val);
    Correct(x);
  }
  void UpdateRange(int ll, int rr, int val) {
    UpdateRange(1, 0, size - 1, ll, rr, val);
  }
  inline void Correct(int x) { SUM[x] = SUM[x + x] + SUM[x + x + 1]; }
  void UpdateRange(int x, int l, int r, int ll, int rr, int val) {
    push(x, l, r);
    if (ll > r || l > rr) return;
    if (ll <= l && r <= rr) {
      LAZY[x] += val;
      push(x, l, r);
      return;
    }
    int y = (l + r) >> 1;
    UpdateRange(x + x, l, y, ll, rr, val);
    UpdateRange(x + x + 1, y + 1, r, ll, rr, val);
    Correct(x);
  }
  double Query(int ll, int rr) { return Query(1, 0, size - 1, ll, rr); }
  double Query(int x, int l, int r, int ll, int rr) {
    push(x, l, r);
    if (ll > r || l > rr) return 0;
    if (ll <= l && r <= rr) {
      return SUM[x];
    }
    int y = (l + r) >> 1;
    return Query(x + x, l, y, ll, rr) + Query(x + x + 1, y + 1, r, ll, rr);
  }
};
int main() {
  int n;
  cin >> n;
  pair<double, int> bb[n];
  int b[n];
  int r[n];
  double coefSum = 0;
  double ret = 0;
  SegmentTreeDivideRange sum(n), coef(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
    bb[i] = {b[i], i};
  }
  sort(bb, bb + n);
  for (int i = 0; i < n; ++i) r[bb[i].second] = i;
  for (int i = 0; i < n; ++i) {
    if (b[i] > 0) {
      double oldCoefSum = coefSum;
      coefSum = coefSum / 2 + (i + 1) / 2.0;
      coef.UpdateRange(0, r[i] - 1, 1);
      sum.UpdateRange(0, r[i] - 1, 1);
      double newCoef = coefSum - oldCoefSum + coef.Query(0, r[i] - 1);
      coef.UpdateOne(r[i], newCoef);
      sum.UpdateOne(r[i], newCoef * b[i]);
    }
    ret += sum.Query(0, n - 1);
  }
  ret /= n;
  ret /= n;
  cout << setprecision(20) << ret << endl;
  return 0;
}
