#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cout<<fixed<<setprecision(20);
	cin.tie(0);ios::sync_with_stdio(false);
	llint i,n;cin>>n;
	//x円保険すると、 失うのはmax(x,A-x)
	//失うのの中央値/2保険する
	vector<double>A(n);
	for(i=0;i<n;i++){cin>>A[i];}
	SO(A);
	double x=A[n/2]/2;
	double ans=0;
	for(i=0;i<n;i++){ans+=max(x,A[i]-x);}
	cout<<ans/n<<endl;
	return 0;
}

#include<bits/stdc++.h> 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define f(x, m) for(auto x : m)
#define cpu() ios::sync_with_stdio(false); cin.tie(nullptr)
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int ,int>>
#define vll vector<pair<ll ,ll>>
#define all(v) v.begin(),v.end()
#define sor(a) sort( a.begin(), a.end() )
#define ros(a) sort( a.rbegin(), a.rend())
#define prec(n) fixed << setprecision(n)
#define ff first
#define ss second
#define print(x) for(auto it : x) cout << it << " ";
#define debug(x) cerr << #x << " is " << x << endl;

typedef long long ll;
using namespace std;
// using namespace __gnu_pbds;
#define dbg(args...){ string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> ) {cout << "NEXT\n"; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << ", ";
err(++it, args...);
}
template<typename... T>
void rd(T& ... args){
   (( cin >> args), ...);
}
template<typename... T>
void ps(T ... args){
   ((cout << args << ' '), ...);
   cout << '\n';
}
//  mp.max_load_factor(0.25); 
// using ordered_set = tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>;
const int MOD = 998244353;
const char nl = '\n';      
const int INF = 1e9 + 5; 
int n;
void add(int& x, int y){
   x += y; 
   if(x >= MOD){
      x -= MOD;
   }
}

void res(int& x, int y){
   x -= y; 
   if(x < 0){
      x += MOD;
   }
}
ll pot(ll x, ll y){
   if(y == 0) return 1; 
   if(y & 1) return (pot(x, y - 1) * x) % MOD;
   ll k = pot(x, y / 2);
   return (k * k) % MOD;
}
ll inv(ll x){
   return pot(x, MOD - 2);
}
void solve(){
   cin >> n;
   vi a(n);
   for(int& it : a){
      cin >> it;
   }
   sor(a);
   int cur = 0, ans = 0; 
   ll id = 1;
   for(int i = 0; i < n; i++){
      cur = int((id * a[i] + cur) % MOD);
      id = (id * 2) % MOD;
      add(ans, int((ll(a[i]) * a[i]) % MOD));
   }
   // dbg(cur);
   for(int i = 0; i < n; i++){
      res(cur, a[i]);
      cur = int((499122177LL * cur) % MOD);
      add(ans, int((ll(a[i]) * cur) % MOD));
   }
   cout << ans << "\n";
}
int main(){
   cpu();
   solve();

   return 0;
}