#include <bits/stdc++.h>
using namespace std;
inline long long int maxim(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
inline long long int minim(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int modpow(long long int b, long long int e) {
  long long int ans = 1;
  for (; e; b = (b * b) % 1000000007, e /= 2)
    if (e & 1) ans = ans * b % 1000000007;
  return ans;
}
int modInverse(int a, int m) {
  int m0 = m;
  int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    int q = a / m;
    int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
bool comp(long long int a, long long int b) { return a > b; }
vector<int> cont;
long double arr[1001];
map<string, long double> m;
long double rec(long long int l, long long int r) {
  if (l == r) return arr[l];
  if (l + 1 == r) return (arr[l] + arr[r]) / 2;
  string key = to_string(l) + "|" + to_string(r);
  if (m.find(key) == m.end()) {
    long long int maxo = -2000000000000000;
    for (long long int o = (l), _b = (r - 1); o <= _b; o++) {
      maxo = maxim(maxo, (rec(l, o) + rec(o + 1, r)) / 2);
    }
    m[key] = maxo;
  }
  return m[key];
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cout << setprecision(10) << fixed;
  long long int n;
  cin >> n;
  for (long long int i = 0, _n = (n); i < _n; i++) cin >> arr[i];
  cout << rec(0, n - 1) << endl;
  return 0;
}
