#include <bits/stdc++.h>
using namespace std;
long double helper(vector<long double> &a, long long int st, long long int e,
                   vector<vector<long double> > &dp) {
  if (st == e) return a[st];
  if (e - st + 1 == 2) return (a[st] + a[e]) / 2.0;
  if (dp[st][e] != -1) return dp[st][e];
  long double ans = -(long long int)(1e16);
  for (long long int i = st + 1; i < e; i++)
    ans = max(ans, (helper(a, st, i - 1, dp) + helper(a, i, e, dp)) / 2.0);
  return dp[st][e] = ans;
}
void solve() {
  long long int n;
  cin >> n;
  vector<long double> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  vector<vector<long double> > dp(n + 1, vector<long double>(n + 1, -1));
  cout << helper(a, 0, n - 1, dp);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) solve();
  return 0;
}
