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:
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

struct node{int x,y,a,b,c,d;}p[maxn];
int bx[maxn],by[maxn],cntx,cnty,n,c[maxn];
const ll mod=998244353;

inline void add(int x,int val){for(int i=x;i<=n;i+=i&(-i)) c[i]+=val;}
inline int q(int x){int res=0; for(int i=x;i;i-=i&-i) res+=c[i]; return res;}

inline bool cmp1(node a,node b){return a.x<b.x;}
inline bool cmp2(node a,node b){return a.y<b.y;}

inline ll pw(ll a,ll b)
{
	ll ans=1,base=a;
	while(b)
	{
		if(b&1) ans=(ans*base)%mod;
		base=(base*base)%mod; b>>=1;
	}
	return ans;
}

inline ll M(ll a,ll b){return (a*b)%mod;}

inline ll gs(int i)
{
	ll a=pw(2,p[i].a),b=pw(2,p[i].b),c=pw(2,p[i].c),d=pw(2,p[i].d);
	ll p1=M(M(M(c,d),a-1),b-1);
	ll p2=M(M(M(a,b),c-1),d-1);
	ll p3=M(M(M(a-1,b-1),c-1),d-1);
	return (p1+p2-p3+mod)%mod;
}

inline ll g2(int x)
{
	int cnt=0;
	while(x) {if(x&1) cnt++; x>>=1;}
	return cnt;
}

int main()
{
	n=read(); rep(i,1,n) p[i].x=read(),p[i].y=read(),bx[++cntx]=p[i].x,by[++cnty]=p[i].y;
	sort(bx+1,bx+cntx+1); sort(by+1,by+cnty+1); sort(p+1,p+n+1,cmp1);
	rep(i,1,n)
	{
		int tmp=lower_bound(by+1,by+cnty+1,p[i].y)-by;
		p[i].c=q(tmp); p[i].a=i-1-p[i].c; add(tmp,1);
	}
	rep(i,1,n) c[i]=0; sort(p+1,p+n+1,cmp2);
	rep(i,1,n)
	{
		int tmp=lower_bound(bx+1,bx+cntx+1,p[i].x)-bx;
		p[i].c=q(tmp); p[i].b=i-1-p[i].c; add(tmp,1); p[i].d=n-1-p[i].a-p[i].b-p[i].c;
	}
	ll ans=0;
	rep(i,1,n) ans=(ans+gs(i))%mod; ans=(ans+M(n,pw(2,n-1)))%mod;
	printf("%lld\n",ans);
	return 0;
}