Problem: We have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.

For a non-empty subset T of S, let f(T) be the number of points contained in the smallest rectangle, whose sides are parallel to the coordinate axes, that contains all the points in T. More formally, we define f(T) as follows:

* f(T) :=  (the number of integers i (1 \leq i \leq N) such that a \leq x_i \leq b and c \leq y_i \leq d, where a, b, c, and d are the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate of the points in T)



Find the sum of f(T) over all non-empty subset T of S. Since it can be enormous, print the sum modulo 998244353.

Constraints

* 1 \leq N \leq 2 \times 10^5
* -10^9 \leq x_i, y_i \leq 10^9
* x_i \neq x_j (i \neq j)
* y_i \neq y_j (i \neq j)
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
x_1 y_1
:
x_N y_N


Output

Print the sum of f(T) over all non-empty subset T of S, modulo 998244353.

Examples

Input

3
-1 3
2 1
3 -2


Output

13


Input

4
1 4
2 1
3 3
4 2


Output

34


Input

10
19 -11
-3 -12
5 3
3 -15
8 -14
-9 -20
10 -9
0 2
-7 17
6 -6


Output

7222

Solution (in CPP):

Solution:
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=200005,mod=998244353;
int n,tot,ans,now,x[N],y[N],hx[N],hy[N],bx[N],by[N],root[N],pw2[N],ch[N*30][2],sumv[N*30];
void update(int y,int &x,int l,int r,int k){
	x=++tot;
	sumv[x]=sumv[y]+1;
	if(l==r){
		return;
	}
	ch[x][0]=ch[y][0];
	ch[x][1]=ch[y][1];
	int mid=(l+r)/2;
	if(k<=mid){
		update(ch[y][0],ch[x][0],l,mid,k);
	}else{
		update(ch[y][1],ch[x][1],mid+1,r,k);
	}
}
int query(int y,int x,int l,int r,int L,int R){
	if(sumv[x]-sumv[y]==0){
		return 0;
	}
	if(L<=l&&R>=r){
		return sumv[x]-sumv[y];
	}
	int mid=(l+r)/2,res=0;
	if(L<=mid){
		res+=query(ch[y][0],ch[x][0],l,mid,L,R);
	}
	if(R>mid){
		res+=query(ch[y][1],ch[x][1],mid+1,r,L,R);
	}
	return res;
}
int get(int xl,int xr,int yl,int yr){
	if(xl>xr||yl>yr){
		return 0;
	}
	return query(root[xl-1],root[xr],1,hy[0],yl,yr);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x[i],&y[i]);
		hx[++hx[0]]=x[i];
		hy[++hy[0]]=y[i];
	}
	pw2[0]=1;
	for(int i=1;i<=n;i++){
		pw2[i]=pw2[i-1]*2%mod;
	}
	sort(hx+1,hx+hx[0]+1);
	hx[0]=unique(hx+1,hx+hx[0]+1)-hx-1;
	sort(hy+1,hy+hy[0]+1);
	hy[0]=unique(hy+1,hy+hy[0]+1)-hy-1;
	for(int i=1;i<=n;i++){
		x[i]=lower_bound(hx+1,hx+hx[0]+1,x[i])-hx;
		bx[x[i]]=i;
		y[i]=lower_bound(hy+1,hy+hy[0]+1,y[i])-hy;
		by[y[i]]=i;
	}
	for(int i=1;i<=hx[0];i++){
		update(root[i-1],root[i],1,hy[0],y[bx[i]]);
	}
	for(int i=1;i<=n;i++){
		now=pw2[n];
		now=(now-pw2[get(1,x[i]-1,1,hy[0])]+mod)%mod;
		now=(now-pw2[get(x[i]+1,hx[0],1,hy[0])]+mod)%mod;
		now=(now-pw2[get(1,hx[0],1,y[i]-1)]+mod)%mod;
		now=(now-pw2[get(1,hx[0],y[i]+1,hy[0])]+mod)%mod;
		now=(now+pw2[get(1,x[i]-1,1,y[i]-1)])%mod;
		now=(now+pw2[get(1,x[i]-1,y[i]+1,hy[0])])%mod;
		now=(now+pw2[get(x[i]+1,hx[0],1,y[i]-1)])%mod;
		now=(now+pw2[get(x[i]+1,hx[0],y[i]+1,hy[0])])%mod;
		now=(now-1+mod)%mod;
		ans=(ans+now)%mod;
	}
	printf("%d\n",ans);
	return 0;
}