#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MAX = 100005;
const long double PI = 3.14159265359;
const long double G = 9.807;
const long long INF = 1e18;
const long double EPS = 1e-6;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
bool isprime(long long a) {
  if (a == 2) return 1;
  if (!(a & 1)) return 0;
  for (long long i = 3; i * i <= a; i += 2)
    if (a % i == 0) return 0;
  return 1;
}
long long mpow(long long base, long long exponent, long long modulus) {
  if (modulus == 1) return 0;
  long long result = 1;
  base = base % modulus;
  while (exponent) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long minv(long long a, long long mod) {
  long long _gcd = gcd(a, mod);
  assert(_gcd == 1);
  return mpow(a, mod - 2, mod);
}
long long n;
long double a[55];
long double done[55][55], dp[55][55];
long double solve(long long l, long long r) {
  if (l == r) {
    return a[l];
  }
  if (r - l + 1 == 2) {
    return (a[l] + a[r]) / 2;
  }
  if (done[l][r]) return dp[l][r];
  long double ans = 0;
  for (long long i = l; i < r; i++) {
    ans = max(ans, (solve(l, i) + solve(l + 1, r)) / 2);
  }
  done[l][r] = 1;
  return dp[l][r] = ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(8);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cout << solve(1, n);
  return 0;
}
