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>
using namespace std;


typedef long long ll;
#define reg register
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)


char IO;
inline ll rd(){
	ll s=0,f=0;
	while(!isdigit(IO=getchar())) if(IO=='-') f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(isdigit(IO=getchar()));
	return f?-s:s;
}


const int N=2e5+10,P=998244353;

int n;
struct node{
	int x,y;
	bool operator < (const node __) const{
		return x<__.x;
	}
}a[N];
int hx[N],cx,hy[N],cy;

struct BIT{
	int s[N];
	void Add(int p,int x){
		while(p<=cy) s[p]+=x,p+=p&-p;
	}
	int Que(int p){
		int res=0;
		while(p) res+=s[p],p-=p&-p;
		return res;
	}
}B[2];

int po[N]={1};

int main(){
	rep(i,1,n=rd()) a[i].x=hx[i]=rd(),a[i].y=hy[i]=rd();
	rep(i,1,N-1) po[i]=po[i-1]*2%P;
	sort(hx+1,hx+n+1),cx=unique(hx+1,hx+n+1)-hx-1;
	sort(hy+1,hy+n+1),cy=unique(hy+1,hy+n+1)-hy-1;
	rep(i,1,n) {
		a[i].x=lower_bound(hx+1,hx+cx+1,a[i].x)-hx;
		a[i].y=lower_bound(hy+1,hy+cy+1,a[i].y)-hy;
		B[1].Add(a[i].y,1);
	}
	sort(a+1,a+n+1);
	//int A=(1<<4)-1;
	ll ans=0;
	rep(i,1,n){
		B[0].Add(a[i].y,1);
		ll a1=B[0].Que(a[i].y-1),b=i-1-a1,c=B[1].Que(a[i].y-1),d=n-i-c;
		a1=po[a1],b=po[b],c=po[c],d=po[d];
		ll t=a1*b%P*c%P*d%P;
		t-=a1*b%P;
		t-=a1*c%P;
		t-=c*d%P;
		t-=b*d%P;
		t+=(a1+b+c+d+1+1)%P;
		t-=4;
		t+=1;
		t%=P;
		//cout<<t<<endl;
		(ans+=t)%=P;
		(ans+=po[n-1])%=P;
		//cout<<a1<<' '<<b<<' '<<c<<' '<<d<<endl;
		/*rep(S,0,A) {
			if(!(S&1)&&!(S&2)) continue;
			if(!(S&1)&&!(S&4)) continue;
			if(!(S&4)&&!(S&8)) continue;
			if(!(S&2)&&!(S&8)) continue;
			ll t=1;
			int cnt=0;
			if(S&1) a1--,cnt^=1;
			if(S&2) b--,cnt^=1;
			if(S&4) c--,cnt^=1;
			if(S&8) d--,cnt^=1;
			t=a1*b%P*c%P*d%P;
			if(cnt) (ans-=t)%=P;
			else (ans+=t)%=P;
			if(S&1) a1++,cnt^=1;
			if(S&2) b++,cnt^=1;
			if(S&4) c++,cnt^=1;
			if(S&8) d++,cnt^=1;
		}
		*/
		B[1].Add(a[i].y,-1);
	}
	printf("%lld\n",(ans%P+P)%P);
}