#include <bits/stdc++.h>
using namespace std;

typedef long long lli;
int MOD = 998244353;
inline int add(const int a, const int b, const int mod = MOD) { return (a + b >= mod) ? (a + b - mod) : (a + b); }
inline void _add(int &a, const int b, const int mod = MOD) { a = add(a, b, mod); }
inline int sub(const int a, const int b, const int mod = MOD) { return (a - b < 0) ? (a - b + mod) : (a - b); }
inline void _sub(int &a, const int b, const int mod = MOD) { a = sub(a, b, mod); }
inline int negate(const int a, const int mod = MOD) { return mod - a; }
inline int mul(const int a, const int b, const int mod = MOD) { return (a * 1ll * b) % mod; }
inline void _mul(int &a, const int b, const int mod = MOD) { a = mul(a, b, mod); }
int binPow(int b, lli p, const int mod = MOD) {
	int r = 1;
	while (p) {
		if (p & 1) r = mul(r, b, mod);
		b = mul(b, b, mod);
		p >>= 1;
	}
	return r;
}
int gcdex(int a, int b, int &x, int &y) {
	if (!b) return x = 1, y = 0, a;
	int px, py, res = gcdex(b, a % b, px, py);
	return x = py, y = px - a / b * py, res;
}
int inv(const int a, const int mod = MOD) { // a and mod must be coprime
	int x, y;
	int g = gcdex(a, mod, x, y);
	assert(g == 1);
	x = (x % mod + mod) % mod;
	return x;
}
inline int dvd(const int a, const int b, const int mod = MOD) { // b and mod must be coprime
	int rev = inv(b, mod);
	return mul(a, inv(b, mod), mod);
} // b != 0
inline void _dvd(int &a, const int b, const int mod = MOD) { a = dvd(a, b, mod); } // b and mod must be coprime
inline int convert(int x, const int mod = MOD) {
	int tx = x % mod + mod;
	return tx >= mod ? tx - mod : tx;
};

int main () {
    int n;
    int i2 = inv(2);
    while (scanf("%d", &n) == 1) {
        vector<int> a(n);
        for (auto &x : a) scanf("%d", &x);
        sort(a.begin(), a.end());

        int pol = 0;
        for (int i = 0; i < n; i++) pol = add(mul(pol, 2), a[i]);
        
        int res = 0;
        for (int i = n - 1; i >= 0; i--) {
            _sub(pol, a[i]);
            _mul(pol, i2);
            _add(res, mul(a[i], add(pol, a[i])));
        }

        printf("%d\n\n", res);
    }
}



#include<bits/stdc++.h>
using namespace std;
namespace IO
{
    const int buf_size=1<<20;
    char buf[buf_size],*S,*T;
    inline char read_char()
    {
        if(S==T)
            T=(S=buf)+fread(buf,1,buf_size,stdin);
        return S!=T?*(S++):EOF;
    }
    bool flag_EOF;
    inline int read_int()
    {
        char c=read_char();
        bool neg=false;
        while(c<'0'||c>'9')
        {
            if(c==EOF)
            {
                flag_EOF=true;
                return 0;
            }
            neg=(c=='-');
            c=read_char();
        }
        int x=0;
        while(c>='0'&&c<='9')
        {
            x=x*10+(c^48);
            c=read_char();
        }
        return neg?-x:x;
    }
    inline void read_string(char *s)
    {
        char c=read_char();
        while(c<'a'||c>'z')
        {
            if(c==EOF)
            {
                flag_EOF=true;
                return;
            }
            c=read_char();
        }
        while(c>='a'&&c<='z')
        {
            *(s++)=c;
            c=read_char();
        }
        *s='\0';
    }
    inline double read_double()
    {
        char c=read_char();
        bool neg=false;
        while(c<'0'||c>'9')
        {
            if(c==EOF)
            {
                flag_EOF=true;
                return 0;
            }
            neg=(c=='-');
            c=read_char();
        }
        double x=0;
        while(c>='0'&&c<='9')
        {
            x=x*10+(c^48);
            c=read_char();
        }
        if(c=='.')
        {
            c=read_char();
            double eps=1;
            while(c>='0'&&c<='9')
            {
                eps*=0.1;
                x+=eps*(c^48);
                c=read_char();
            }
        }
        return neg?-x:x;
    }
    char fw[buf_size];
    int pw;
    inline void flush()
    {
        fwrite(fw,1,pw,stdout);
        pw=0;
    }
    inline void write_char(char x)
    {
        if(pw==buf_size)
            flush();
        fw[pw++]=x;
    }
    char st[26];
    int top;
    inline void write_int(int x)
    {
        if(!x)
        {
            write_char('0');
            return;
        }
        if(x<0)
        {
            write_char('-');
            x=-x;
        }
        while(x)
        {
            st[++top]=x%10^48;
            x/=10;
        }
        while(top>0)
            write_char(st[top--]);
    }
    inline void write_string(const char *s)
    {
        for(int i=0;s[i];++i)
            write_char(s[i]);
    }
    inline void write_double(double x,int cnt_digits,bool mark=true)
    {
        if(x<0)
        {
            write_char('-');
            x=-x;
        }
        if(mark)
            x+=5*pow(0.1,cnt_digits+1);
        write_int(int(x));
        if(cnt_digits>0)
        {
            write_char('.');
            for(int i=1;i<=cnt_digits;++i)
            {
                x-=int(x),x*=10;
                write_char(int(x)^48);
            }
        }
    }
}
const int max_N=2e5+5;
int A[max_N];
const int mod=998244353;
const int inv2=(mod+1)>>1;
int pow2[max_N],pow_inv2[max_N];
int main()
{
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;++i)
		scanf("%d",A+i);
	sort(A+1,A+N+1);
	pow2[0]=pow_inv2[0]=1;
	for(int i=1;i<=N;++i)
	{
		pow2[i]=2ll*pow2[i-1]%mod;
		pow_inv2[i]=1ll*inv2*pow_inv2[i-1]%mod;
	}
	int ans=0,sum=0;
	for(int i=1;i<=N;++i)
	{
		ans=(ans+1ll*sum*A[i]%mod*pow2[i-1])%mod; 
		ans=(ans+1ll*A[i]*A[i])%mod;
		sum=(sum+1ll*A[i]*pow_inv2[i])%mod;
	}
	printf("%d\n",ans);
    IO::flush();
    return 0;
}
