#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int lim = pow(2, N);
  vector<double> dp(lim, 0);
  for (int i = 0; i < N; ++i) {
    cin >> dp[pow(2, i)];
  }
  bitset<50> temp;
  for (int i = 0; i < N; ++i) {
    for (int j = 1; j < lim - 1; ++j) {
      temp = bitset<50>(j);
      if (dp[j] > 0 && !temp[i]) {
        dp[j + pow(2, i)] = max((dp[pow(2, i)] + dp[j]) / 2, dp[j + pow(2, i)]);
      }
    }
  }
  cout << setprecision(20) << dp[lim - 1] << endl;
  return 0;
}
