#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 10,mod = 998244353;
int a[N];
int s[N];
int n;
int qpow(int a,int b){
	int res = 1;
	while(b){
		if(b & 1) res = res * a % mod;
		a = a * a % mod;
		b>>=1;
	}
	return res;
}
int inv(int a){return qpow(a,mod-2);}
signed main(){
	cin >> n;
	for(int i=1;i<=n;i++) cin >> a[i];
	sort(a+1,a+n+1);
	int ans = 0ll;
	for(int i=1;i<=n;i++) ans = (ans + a[i] * a[i]) % mod;
	for(int i=1;i<=n;i++) s[i] = ((s[i-1] + a[i] * (qpow(2,n-i+1)))%mod + mod) % mod;
	for(int i=1;i<=n;i++){
		if(i == 1) continue;
		int cur = s[i-1] * inv(qpow(2,n-i+2)) % mod;
		ans = (ans + cur * a[i]) % mod;
	}
	cout << (ans%mod+mod)%mod << endl;
	return 0;
}
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<queue>
#include<stack>
#include<utility>
#include<cstdlib>
#include<cstdio>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<list>
#include<tuple>
using namespace std;

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define FOR(i, a, b) for(ll i=(a); i<(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n+1)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ld INF=1e18;

int main(void){
    ll N; cin>>N;
    vl A(N);
    REP(i,N) cin>>A[i];
    sort(A.begin(),A.end());
    
    ld res=INF;
    ll cnt=0, sum=0;
    for(ll i=N-1; i>=0; --i){
        if(i==N-1){
            sum=0;
            cnt++;
        }
        else{
            sum+=(A[i+1]-A[i])*cnt;
            cnt++;
        }
        ld p=(ld)A[i]/2+(ld)sum/N;
        chmin(res,p);
    }
    cout<<fixed<<setprecision(20);
    cout<<res<<endl;
    return 0;
}