#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<vector<pair<double, double>>> dp(
      n, vector<pair<double, double>>(n - 1, pair<double, double>(0.0, 0.0)));
  vector<double> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n - 1; ++i) {
    dp[0][i].first = v[0] / pow(2.0, (double)(i + 1));
    dp[0][i].second = 1.0 / pow(2.0, (double)(i + 1));
  }
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < n - 1; ++j) {
      for (int k = n - 2;
           dp[i][j].second + 1.0 / pow(2.0, (double)(k + 1)) <= 1.0 && k > -1;
           --k) {
        if (dp[i][j].first + v[i + 1] / pow(2.0, (double)(k + 1)) >
            dp[i + 1][k].first) {
          dp[i + 1][k].first =
              dp[i][j].first + v[i + 1] / pow(2.0, (double)(k + 1));
          dp[i + 1][k].second =
              dp[i][j].second + 1.0 / pow(2.0, (double)(k + 1));
        }
      }
    }
  }
  double ans = 0.0;
  for (int i = 0; i < n - 1; ++i) {
    if (dp[n - 1][i].second == 1.0) {
      ans = max(ans, dp[n - 1][i].first);
    }
  }
  cout << ans << endl;
  return 0;
}
