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<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define ll long long
#define mod 998244353
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20],len; len=0;
	if(x<0)x=-x,putchar('-');
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
struct Data{
	int x,id;
}num[maxn];
struct point{
	int x,y,rk;
}a[maxn];
int n;
bool cmp1(Data a,Data b){return a.x<b.x;}
bool cmp2(point a,point b){return a.x<b.x;}
inline ll power(ll a,ll b)
{
	ll ans=1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1)ans=ans*a%mod;
	return ans;
}
int bit1[maxn],bit2[maxn];
void add1(int x,int k){for(;x<=n;x+=x&(-x))bit1[x]+=k;}
int getsum1(int x){int sum=0; for(;x;x-=x&(-x))sum+=bit1[x]; return sum;}
void add2(int x,int k){for(;x<=n;x+=x&(-x))bit2[x]+=k;}
int getsum2(int x){int sum=0; for(;x;x-=x&(-x))sum+=bit2[x]; return sum;}
int main()
{
	n=read();
	for(int i=1;i<=n;i++){
		a[i].x=read(); a[i].y=read();
		num[i].x=a[i].y; num[i].id=i;
	}
	std::sort(num+1,num+n+1,cmp1);
	for(int i=1;i<=n;i++)
		a[num[i].id].rk=i;
	std::sort(a+1,a+n+1,cmp2);
	for(int i=1;i<=n;i++)
		bit1[i]=0,bit2[i]=i&(-i);
	ll ans=0;
	for(int i=1;i<=n;i++){
		add2(a[i].rk,-1);
		int A=getsum1(a[i].rk),B=getsum1(n)-getsum1(a[i].rk),C=getsum2(a[i].rk),D=getsum2(n)-getsum2(a[i].rk);
		// printf("%d %d %d : %d %d %d %d\n",i,a[i].x,a[i].y,A,B,C,D);
		ll totA=power(2,A),totB=power(2,B),totC=power(2,C),totD=power(2,D);
		ans=(ans+(totA-1)*totB%mod*totC%mod*(totD-1))%mod;
		ans=(ans+totA*(totB-1)%mod*(totC-1)%mod*totD)%mod;
		ans=(ans-(totA-1)*(totB-1)%mod*(totC-1)%mod*(totD-1)%mod+mod)%mod;
		ans=(ans+power(2,n-1))%mod;
		add1(a[i].rk,1);
	}
	writeln(ans);
	return 0;
}