#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, const U &b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, const U &b){ return b > a ? a = b, true : false; }

int n;
vector<ld> a;

ld f(ld x){
    ld sum = 0;
    for(int i = 0; i < n; ++i){
        sum += x + a[i] - min(a[i], 2 * x);
    }
    return sum;
}

ld ternary_search(ld l, ld r) {
    ld eps = 1e-9;              //set the error limit here
    while (r - l > eps) {
        ld m1 = l + (r - l) / 3;
        ld m2 = r - (r - l) / 3;
        ld f1 = f(m1);      //evaluates the function at m1
        ld f2 = f(m2);      //evaluates the function at m2
        if (f1 > f2)
            l = m1;
        else
            r = m2;
    }
    return f(l);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n; a.assign(n, 0);
    for(int i = 0; i < n; ++i) cin >> a[i];
    cout << setprecision(10) << fixed;
    cout << ternary_search(0, 1e9 + 7)/n;
    return 0;
}
    #include <bits/stdc++.h>
    using namespace std;
    #define rep(i,n) for(int i=0;i < n;i++)
    typedef long long ll;
    

    int main(){
        int n;
        cin >> n;
        vector<long long> a(n);
        rep(i,n){
            cin >> a[i];
        }
        sort(a.begin(),a.end());
        vector<long long> stacksum(n);
        for(int i=0;i < n;i++){
            stacksum[i] = i == 0 ? a[0] : a[i] + stacksum[i-1];
        }
        double ave = 0;
        rep(i,n){
            ave += a[i];
        }
        ave = ave / n;
        double lostmin = 1000000000000000.0;
        for(int i=0; i<n; i++){
            double x = (double)a[i] / 2;
            long long al = i == 0 ? 0 : stacksum[i-1];
            double lost = x + ave - ((2*x*(n-i) + al) / (double) n);
            lostmin = min(lostmin,lost);
        }
        
        printf("%.12lf\n",lostmin);
        return 0;
    }