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;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define int long long
#define mod 998244353
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 200005
int lowbit(int x){return x&(-x);}
struct Node
{
	int x,y,rk,num;// y rk
};
Node a[N];
Node b[N];
bool cmp1(Node x,Node y)
{
	return x.y<y.y;
}
bool cmp2(Node x,Node y)
{
	return x.x<y.x;
}
int t1[N],t2[N];
int n;
void add1(int u,int d)
{
	while(u<=n) t1[u]+=d,u+=lowbit(u);
}
void add2(int u,int d)
{
	while(u<=n) t2[u]+=d,u+=lowbit(u);
}
int sum1(int u)
{
	int ans=0;
	while(u) ans+=t1[u],u-=lowbit(u);
	return ans;
}
int sum2(int u)
{
	int ans=0;
	while(u) ans+=t2[u],u-=lowbit(u);
	return ans;
}
int qpow(int x,int y)
{
	int ans=1;
	while(y)
	{
		if(y&1) ans=ans*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return ans;
}
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i].x=read(),a[i].y=read();
		b[i].y=a[i].y,b[i].num=i;
	}
	sort(b+1,b+n+1,cmp1);
	for(int i=1;i<=n;i++)
	{
		a[b[i].num].rk=i;
	}
	sort(a+1,a+n+1,cmp2);
	for(int i=1;i<=n;i++)
	{
		add2(i,1);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		add2(a[i].rk,-1);
		int A=sum1(a[i].rk),B=sum1(n)-A,C=sum2(a[i].rk),D=sum2(n)-C;
		int ta=qpow(2,A),tb=qpow(2,B),tc=qpow(2,C),td=qpow(2,D);
		ans=(ans+(ta-1)*(td-1)%mod*tb%mod*tc)%mod;
		ans=(ans+(tb-1)*(tc-1)%mod*ta%mod*td)%mod;
		ans=(ans-(tb-1)*(tc-1)%mod*(ta-1)%mod*(td-1))%mod;
		ans=(ans+qpow(2,n-1));
		add1(a[i].rk,1);
	}
	ans=(ans%mod+mod)%mod;
	cout<<ans<<endl;
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}