#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

double calculate_expected(double x, ll nums[], ll n, ll sum, unordered_map<double, double>& visited) {
    if(visited.find(x) != visited.end()){
        return visited[x];
    }

    double expected_val = sum + x*n;
    for(int i=0; i<n; i++) {
        expected_val -= min((double)nums[i], 2*x);
    }

    double exp = expected_val/n;
    visited[x] = exp;
    //cout << endl << x << " expected val: " << exp << endl;
    return exp;
}

double binary_s(double min_v, double max, ll sum, ll n, ll nums[], double err, unordered_map<double, double>& visited) {
    //cout << endl << min_v << " " << max << endl;
    double mid = (max+min_v)/2;
    if(max-min_v < err)
        return mid;
    
    double quarter = (mid+min_v)/2;
    double three_quarter = (max+mid)/2;

    double min_exp = calculate_expected(min_v, nums, n, sum, visited);
    double quarter_exp = calculate_expected(quarter, nums, n, sum, visited);
    double mid_exp = calculate_expected(mid, nums, n, sum, visited);
    double three_quarter_exp = calculate_expected(three_quarter, nums, n, sum, visited);
    double max_exp = calculate_expected(max, nums, n, sum, visited);

    if(quarter_exp < min_exp && quarter_exp < mid_exp) {
        return binary_s(min_v, mid, sum, n, nums, err, visited);
    }
    if(three_quarter_exp < mid_exp && three_quarter_exp < max_exp) {
        return binary_s(mid, max, sum, n, nums, err, visited);
    }

    return binary_s(quarter, three_quarter, sum, n, nums, err, visited);
}

void solve(ll nums[], ll n) {
    ll sum = 0;
    ll max = 0;
    for(int i=0; i<n; i++) {
        sum += nums[i];
        if(nums[i]>max)
            max = nums[i];
    }

    double average = (sum*1.0)/n;
    unordered_map<double, double> visited;

    double val = binary_s(0, average, sum, n, nums, 0.000001, visited);
    cout.precision(30);
    cout << calculate_expected(val, nums, n, sum, visited) << endl;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n;
    cin >> n;
    
    ll nums[n];
    for(int i=0; i<n; i++) {
        cin >> nums[i];
    }

    solve(nums, n);
}
#include <bits/stdc++.h>
 
using namespace std; 
 
#define int long long
#define double long double

template <typename T> 
void print_vec(const vector<T>& v, bool newline = true) {
    for (int i = 0; i < v.size(); ++i) {
        cout << v[i] << " ";
    }
    if (newline) {
        cout << "\n";
    }
}
 
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
 
const int maxn = (int)2e5 + 105;
const int mod = (int)1e9 + 7; 
 
#define sz(x) ((int)(x.size()))
 
#define pb push_back
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
 
int fact_setup=0; int * fact; 
 
int ex (int a, int b){
    if(b==0)return 1; int e = ex(a,b/2); e=(1ll*e*e)%mod; if(b&1)e=(1ll*e*a)%mod; return e;
}
int inv (int a){
    return ex(a, mod - 2); 
}
int choose (int a, int b){
    if(!fact_setup){
        fact_setup=1; 
        fact = new int [maxn]; 
        fact[0]=1; rep (i,1,maxn-1) fact[i]=(i*fact[i-1])%mod; 
    }
    if(a<b)return 0; 
    int num = fact[a]; 
    int denom = (fact[b] * fact[a - b]) % mod; 
    return (num * inv(denom)) % mod; 
}
 
#define pii pair <int, int> 
#define pvi pair <vector <int>, int> 
 
#define pai array <int,2>
#define pdi array <double, 2> 
#define pdt array <double, 3>
 
#define pti array <int,3>
#define pfi array <int,4>
 
#define all(v) v.begin(), v.end()


int arr [maxn]; 

main(){
    cin.tie(0); ios_base::sync_with_stdio(0); 
	int n; cin >> n; 
	double tot=0; 
	rep (i,1,n) {cin >> arr[i];tot+=arr[i];}
	tot/=(double)n; 
	sort(arr+1,arr+n+1); 
	
	double cur=0, ans = 0; 
	rep (i,1,n){
		double tt = ((n - i + 1) * arr[i] + cur) / (double)n - (arr[i]/2.0); 
		ans = max(ans, tt); 
		cur+=arr[i];
	}
	cout<<fixed<<setprecision(12) << tot-ans << '\n'; 
    return 0; 
}
