#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using ld = long double;
const int MAXN = 55;
ld dp[MAXN][MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  for (int l = n - 1; l >= 0; --l)
    for (int r = l; r < n; ++r) {
      if (l == r)
        dp[l][r] = a[l];
      else {
        dp[l][r] = 0;
        for (int i = l; i < r; ++i)
          dp[l][r] = max(dp[l][r], dp[l][i] + dp[i + 1][r]);
        dp[l][r] /= 2;
      }
    }
  cout << setprecision(9) << fixed << dp[0][n - 1];
  return 0;
}
