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<bits/stdc++.h>
#define int long long
#define MAXN 200010
using namespace std;
int n,X[MAXN],Y[MAXN],x[MAXN],y[MAXN],lenx,leny,ans;
const int MOD=998244353;
int point[MAXN];
int Quick_Pow(int x,int p) {
	int res=1;
	while(p) {
		if(p&1)res=res*x%MOD;
		x=x*x%MOD;
		p=p>>1;
	}
	return (res+MOD-1)%MOD;
}
struct ___ {
	int num_up[MAXN],num_down[MAXN];
	void AddUp(int i,int x) {
		while(i>=1)num_up[i]+=x,i-=i&-i;
	}
	void AddDown(int i,int x) {
		while(i<=n)num_down[i]+=x,i+=i&-i;
	}
	int QueryUp(int i) {
		int res=0;
		while(i<=n)res+=num_up[i],i+=i&-i;
		return res;
	}
	int QueryDown(int i) {
		int res=0;
		while(i>=1)res+=num_down[i],i-=i&-i;
		return res;
	}
} BIT1,BIT2;
signed main() {
	scanf("%lld",&n);
	for(int i=1; i<=n; i++) {
		scanf("%lld %lld",&X[i],&Y[i]);
		x[i]=X[i],y[i]=Y[i];
	}
	ans+=n*(Quick_Pow(2,n))%MOD,ans%=MOD;
	for(int i=1;i<=n;i++){
		int res=2*(Quick_Pow(2,i-1)+Quick_Pow(2,n-i));
		res%=MOD;
		ans-=res,ans=(ans+MOD)%MOD;
	}
	sort(x+1,x+1+n),sort(y+1,y+1+n);
	lenx=unique(x+1,x+1+n)-x-1,leny=unique(y+1,y+1+n)-y-1;
	for(int i=1; i<=n; i++)X[i]=lower_bound(x+1,x+1+lenx,X[i])-x,Y[i]=lower_bound(y+1,y+1+leny,Y[i])-y;
	for(int i=1; i<=n; i++)BIT2.AddDown(Y[i],1),BIT2.AddUp(Y[i],1),point[X[i]]=Y[i];
	for(int i=1;i<=n;i++){
		BIT2.AddDown(point[i],-1),BIT2.AddUp(point[i],-1);
		int sum,res;
		sum=BIT2.QueryUp(point[i]+1);
		res=Quick_Pow(2,sum);
		ans+=res,ans=(ans+MOD)%MOD;
		sum=BIT2.QueryDown(point[i]-1);
		res=Quick_Pow(2,sum);
		ans+=res,ans=(ans+MOD)%MOD;
		sum=BIT1.QueryUp(point[i]+1);
		res=Quick_Pow(2,sum);
		ans+=res,ans=(ans+MOD)%MOD;
		sum=BIT1.QueryDown(point[i]-1);
		res=Quick_Pow(2,sum);
		ans+=res,ans=(ans+MOD)%MOD;
		BIT1.AddDown(point[i],1),BIT1.AddUp(point[i],1);
	}
	cout<<ans;
	return 0;
}