#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const long long Maxn=2e5+10;
const long long Maxm=Maxn<<2;
const long long mod=998244353;
long long a[Maxn],c[Maxn];
long long tag[Maxm],sum[Maxm];
long long p[Maxn];
long long n,ans;
inline long long read()
{
	long long s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
inline bool cmp(long long x,long long y)
{
	return a[x]<a[y];
}
long long power(long long x,long long y)
{
	long long ret=1ll,base=x;
	while(y)
	{
		if(y & 1)ret=(ret*base)%mod;
		base=(base*base)%mod;
		y>>=1;
	}
	return ret;
}
inline long long inv(long long x)
{
	return power(x,mod-2);
}
inline void push_up(long long k)
{
	sum[k]=(sum[k<<1]+sum[k<<1|1])%mod;
}
inline void upd(long long k,long long v)
{
	tag[k]=(tag[k]*v)%mod;
	sum[k]=(sum[k]*v)%mod;
}
inline void push_down(long long k)
{
	if(tag[k]==1ll)return;
	upd(k<<1,tag[k]);
	upd(k<<1|1,tag[k]);
	tag[k]=1ll;
}
void build(long long k,long long l,long long r)
{
	tag[k]=1ll;
	if(l==r)
	{
		if(l==1)sum[k]=(a[c[l]])%mod;
		else sum[k]=(p[l-2]*a[c[l]])%mod;
		return;
	}
	long long mid=(l+r)>>1;
	build(k<<1,l,mid);
	build(k<<1|1,mid+1,r);
	push_up(k);
}
void modify(long long k,long long l,long long r,long long x,long long y,long long v)
{
	if(x<=l && r<=y)return upd(k,v);
	push_down(k);
	long long mid=(l+r)>>1;
	if(x<=mid)modify(k<<1,l,mid,x,y,v);
	if(mid<y)modify(k<<1|1,mid+1,r,x,y,v);
	push_up(k);
}
long long query(long long k,long long l,long long r,long long x,long long y)
{
	if(x<=l && r<=y)return sum[k];
	push_down(k);
	long long mid=(l+r)>>1,ret=0ll;
	if(x<=mid)ret=query(k<<1,l,mid,x,y);
	if(mid<y)ret=(ret+query(k<<1|1,mid+1,r,x,y))%mod;
	return ret;
}
int main()
{
	// freopen("in.txt","r",stdin);
	n=read();
	for(long long i=1;i<=n;++i)
	a[i]=read(),c[i]=i;
	sort(c+1,c+1+n,cmp);
	p[0]=1ll;
	for(long long i=1;i<=n;++i)
	p[i]=(p[i-1]*2ll)%mod;
	build(1,1,n);
	long long tmp=inv(2ll);
	for(long long i=1;i<=n;++i)
	{
		ans=(ans+(query(1,1,n,i,n)*a[c[i]])%mod)%mod;
		if(i+2<=n)modify(1,1,n,i+2,n,tmp);
	}
	printf("%lld\n",ans);
	return 0;
}
#include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <tuple>
#include <set>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;



int main(){
  ll n;
  cin >> n;
  vector<vector<ll>> a(n,vector<ll>(2));
  vector<tuple<ll,ll>> x(n);
  vector<tuple<ll,ll>> y(n);
  rep(i,n){
    cin >> a[i][0] >> a[i][1];
    x[i] = make_tuple(a[i][0],i);
    y[i] = make_tuple(a[i][1],i);
  }
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  vector<vector<ll>> c;
  c = {{get<1>(x[0]),get<1>(x[n-1])},{get<1>(x[1]),get<1>(x[n-1])},{get<1>(x[0]),get<1>(x[n-2])}};
  vector<ll> ans;
  rep(i,3){
    vector<ll> d;
    d = c[i];
    ll m = abs(a[d[0]][0]-a[d[1]][0]);
    ll p = abs(a[d[0]][1]-a[d[1]][1]);
    if(m >= p){
      ans.push_back(-m);
    }
  }
  c = {{get<1>(y[0]),get<1>(y[n-1])},{get<1>(y[1]),get<1>(y[n-1])},{get<1>(y[0]),get<1>(y[n-2])}};
  rep(i,3){
    vector<ll> d;
    d = c[i];
    ll m = abs(a[d[0]][0]-a[d[1]][0]);
    ll p = abs(a[d[0]][1]-a[d[1]][1]);
    if(m < p){
      ans.push_back(-p);
    }
  }
  sort(ans.begin(),ans.end());
  cout << -ans[1] << endl;
  
  return 0;
}