#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<cstdio>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define neinf 0xc0c0c0c0c0c0c0c0ll
#define inf 0x3f3f3f3f3f3f3f3fll
#define uint unsigned int
#define ull unsigned ll
#define HgS 1000000007
#define ll long long
#define reg register
#define opr operator
#define ret return
#define gc getchar
#define pc putchar
#define cst const
#define db double
#define il inline
il ll rd()
{
	reg ll res=0,lab=1;
	reg char ch=gc();
	while((ch<'0'||ch>'9')&&ch!=EOF)
	{if(ch=='-')lab=-lab;ch=gc();}
	while(ch>='0'&&ch<='9')
		res=(res<<3)+(res<<1)+(ch&15),ch=gc();
	return res*lab;
}
il void prt(ll x,char t='\n')
{
	static char ch[40];reg int tp=0;
	if(!x){fputs("0",stdout);if(t)pc(t);return;}
	if(x<0)pc('-'),x=-x;
	while(x)ch[++tp]=(x%10)^48,x/=10;
	while(tp)pc(ch[tp--]);
	if(t)pc(t);
}
il ll umax(ll a,ll b){return a>b?a:b;}
il ll umin(ll a,ll b){return a<b?a:b;}
il db umin(db a,db b){return a<b?a:b;}
il ll uabs(ll x){return x>0?x:-x;}
il ll qpow(ll n,ll e=HgS-2,ll p=HgS)
{
	reg ll res=1;
	while(e){if(e&1)res=res*n%p;n=n*n%p;e>>=1;}
	return res;
}
ll n,a[100005];
db f(db x)
{
	db res=0;
	for(int i=1;i<=n;++i)res+=x+a[i]-umin(a[i]*1.0,x*2);
	return res/n;
}
int main()
{
	db l=0,r=1e10,res=-1;
	n=rd();for(int i=1;i<=n;++i)a[i]=rd();
	for(int i=1;i<=100;++i)
	{
		db lm=(l*2+r)/3,rm=(l+r*2)/3,la=f(lm),ra=f(rm);
		if(la+1e-15<ra)r=rm,res=la;else l=lm,res=ra;
	}
	cout<<fixed<<setprecision(15)<<res<<endl;
	return 0;
}

#include <bits/stdc++.h>

// hardwork beats talent when tallent doent work hard...
#define ll long long
#define endl "\n"
ll m = 1000000000 + 7;
#define f(i, t) for (int i = 0; i < t; i++)
ll dp[3005][3005];
using namespace std;
double so(ll arr[], double o, int t)
{
    //  cout << t << endl;

    double o1 = 0;
    f(i, t)
    {
        if (arr[i] > 2 * o)
        {
            o1 += (double)(arr[i] - o);
        }
        else
        {
            o1 += (double)(o);
        }
        //  cout << o1 << " pp" << endl;
    }
    return o1;
}
int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    ll q;
    // cin >> q;
    q = 1;
    f(w, q)
    {
        ll t;
        cin >> t;
        ll s[t];
        long double o = 0, o1 = 0, o3 = 0, o4 = 0, o5 = 0, m = 0, o2 = 0;
        f(i, t)
        {
            cin >> s[i];
            o += s[i];
        }

        sort(s, s + t);
        if (t == 1)
        {
            cout << fixed << setprecision(10) << (double)s[0] / 2 << endl;
            return 0;
        }
        else
        {
            long double l = (double)s[0] / 2, r = s[t - 1];
            while (l != r)
            {
                m = (l + r) / 2;
                o1 = so(s, (double)(l + m) / 2, (int)t);
                o2 = so(s, (double)(r + m) / 2, (int)t);
                // cout << o1 << " " << (l + m) / 2 << endl;
                // cout << o2 << " " << (r + m) / 2 << endl;
                if (o1 <= o2)
                {
                    r = m;
                }
                else
                {
                    l = m;
                }
                if (o1 == o2)
                {
                    l = (l + m) / 2;
                    r = (l + m) / 2;
                }
            }
            // cout << l << endl;

            cout << fixed << setprecision(12) << ((so(s, l, (int)(t))) / t) << endl;
        }
    }
}
