#include <bits/stdc++.h>
using namespace std;
template <typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template <typename T>
inline T mod(T n, T mod) {
  T res = n % mod;
  if (res < 0) res += mod;
  return res;
}
double dp[55][55];
double v[55];
bool vis[55][55];
double solve(int l, int r) {
  if (l == r) return v[l];
  if (vis[l][r]) return dp[l][r];
  vis[l][r] = true;
  return dp[l][r] = max((v[l] + solve(l + 1, r)) / 2.0,
                        (solve(l, r - 1) + v[r]) / 2.0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cout << setprecision(6) << fixed << solve(0, n - 1) << endl;
  return 0;
}
