#include <bits/stdc++.h>
using namespace std;
const long long MOD1 = 1000000007;
const long long MOD2 = 998244353;
#define logn long
#define lnog long
#define lgon long
#define itn int
typedef long long ll;
typedef pair<long long, long long> P;
const long long INF = LLONG_MAX;
//input_arr : 配列 A を入力
template <typename T>
void input_arr(vector<T>& A, long long N) {
    for (long long i = 0; i < N; i++) {
        cin >> A[i];
    }
}
int main() {
    long long N; cin >> N;
    vector<long long>A(N); input_arr(A, N);
    sort(A.begin(), A.end());
    if (N % 2 == 0) {
        long long x1 = A[N/2], x2 = A[N/2-1], x3 = 1e10,x4=1e10;
        if (N > 3) {
            x3 = A[N/2-2];
            x4 = A[N/2+1];
        }
        long double ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0;
        for (long long i = 0; i < N; i++) {
            ans1 += (long double)((long double)x1/2 + A[i] - min(A[i], x1));
            ans2 += (long double)((long double)x2/2 + A[i] - min(A[i], x2));
            ans3 += (long double)((long double)x3/2 + A[i] - min(A[i], x3));
            ans4 += (long double)((long double)x4/2 + A[i] - min(A[i], x4));
        }
        ans1 /= (long double)N;
        ans2 /= (long double)N;
        ans3 /= (long double)N;
        ans4 /= (long double)N;
        cout << fixed << setprecision(12) << min({ans1,ans2,ans3,ans4}) << endl;
    }
    else {
        long long x1 = A[N/2], x2 = 1e10, x3 = 1e10;
        if (N > 2) {
            x2 = A[N/2-1];
            x3 = A[N/2+1];
        }
        long double ans1 = 0, ans2 = 0, ans3 = 0;
        for (long long i = 0; i < N; i++) {
            ans1 += (long double)((long double)x1/2 + A[i] - min(A[i], x1));
            ans2 += (long double)((long double)x2/2 + A[i] - min(A[i], x2));
            ans3 += (long double)((long double)x3/2 + A[i] - min(A[i], x3));
        }
        ans1 /= (long double)N;
        ans2 /= (long double)N;
        ans3 /= (long double)N;
        cout << fixed << setprecision(12) << min({ans1,ans2,ans3}) << endl;
    }
}
#include<cstdio>
#include<algorithm>
#define N 100010
#define db long double
#define ll long long
#define fo(x,a,b) for(int x=(a);x<=(b);x++)
#define fd(x,a,b) for(int x=(a);x>=(b);x--)
using namespace std;
int n;
ll a[N],qz[N],sum=0;
db ans=1e9;

inline int read() {
	int x=0,f=0; char c=getchar();
	while (c<'0'||c>'9') f=(c=='-')?1:f,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return f?-x:x;
}

db calc(db val) {
	int l=1,r=n,mid;
	while (l<=r) {
		mid=(l+r)>>1;
		if (a[mid]+1e-9<val*2.0) l=mid+1;
		else r=mid-1;
	}
	db res=(db)sum+val*n-(db)(qz[l-1]+(n-l+1)*val*2.0);
	res=res/n;
	if (res<ans) ans=res;
	return res;
}

int main() {
	n=read();
	fo(i,1,n) a[i]=read(),sum+=a[i];
	sort(a+1,a+n+1);
	fo(i,1,n) qz[i]=qz[i-1]+a[i];
	db l=0,r=a[n],mid1,mid2;
	while (l+1e-8<r) {
		mid1=l+(r-l)/3.0;
		mid2=r-(r-l)/3.0;
		db val1=calc(mid1),val2=calc(mid2);
		if (val1<val2) r=mid2; else l=mid1;
	}
	printf("%.8Lf\n",ans);
	return 0;
}
