#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

constexpr ll mod=998244353;

ll mod_pow(ll a,ll b){
    a%=mod;
    if(b==0)return 1;
    if(b==1)return a;
    ll res=mod_pow(a,b/2)%mod;
    res*=res; res%=mod;
    if(b%2)res*=a;
    return res%mod;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    ll sum=0;
    ll po=1;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for(int i=1;i<n;i++){
        (sum+=po*a[i]%mod)%=mod;
        po*=2; po%=mod;
    }
    ll res=0;
    for(int i=0;i+1<n;i++){
        (res+=a[i]*sum%mod)%=mod;
        // cout << res << " " << sum << endl;
        sum-=a[i+1];
        sum*=mod_pow(2,mod-2);
        sum%=mod;
    }
    for(int i=0;i<n;i++){
        (res+=a[i]*a[i])%=mod;
    }
    if(res<0)res+=mod;
    cout << res << endl;
}

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

int main(){
  long long n;
  cin >> n;
  
  long long box[210];
  for(int i=0;i<=199;i++){
    box[i]=0;
  }
  
  for(long long i=0;i<n;i++){
    long long a;
    cin >> a;
    a %= 200;
    if(a < 0){ a += 200; }
    if(a >= 200){ a -= 200; }
    box[a] += 1;
  }
  
  long long ans = 0;
  for(int i = 0 ; i <= 199 ; i++){
    ans += (box[i] * (box[i] - 1)) / 2;
  }
  
  cout << ans;
  return 0;
}