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 <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;

typedef long long LL;
const int MO=998244353;
const int M=2e5+5;

int mul(int x,int y)
{
	return (LL)x*y%MO;
}
int add(int x,int y)
{
	x+=y;
	if(x>=MO) x-=MO;
	return x;
}
int sub(int x,int y)
{
	x-=y;
	if(x<0) x+=MO;
	return x;
}

int n;

struct Point
{
	int x,y;
	int id;
	void read(int i)
	{
		id=i;
		scanf("%d%d",&x,&y);
	}
	bool operator<(const Point &B) const
	{
		return x<B.x;
	}
}p[M];

int cnt[M][4];

int bit[M];
void init()
{
	for(int i=1;i<=n;i++)
		bit[i]=0;
}
inline int lowbit(int x)
{
	return x&(-x);
}
void add(int p)
{
	for(;p<=n;p+=lowbit(p))
		bit[p]++;
}
int query(int p)
{
	int ans=0;
	for(;p;p-=lowbit(p))
		ans+=bit[p];
	return ans;
}

int rky[M];
int d[M];
int id(int x)
{
	return lower_bound(d,d+n,x)-d+1;
}

void getcnt()
{
	init();
	sort(p,p+n,[](const Point &a,const Point &b){
		return a.y<b.y;
	});
	for(int i=0;i<n;i++)
		rky[p[i].id]=i;
	sort(p,p+n);
	for(int i=0;i<n;i++)
		d[i]=p[i].y;
	sort(d,d+n);
	for(int i=0;i<n;i++)
	{
		int ld=query(id(p[i].y));
		cnt[p[i].id][0]=ld;
		cnt[p[i].id][1]=i-ld; // lu
		cnt[p[i].id][2]=rky[p[i].id]-ld; // rd
		cnt[p[i].id][3]=n-1-ld-(i-ld)-(rky[p[i].id]-ld); // ru
		add(id(p[i].y));
	}
}

int er[M];

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		p[i].read(i);
	getcnt();
	// for(int i=0;i<n;i++)
	// {
	// 	for(int j=0;j<4;j++)
	// 		cout<<cnt[i][j]<<" ";
	// 	cout<<endl;
	// }
	er[0]=1;
	for(int i=1;i<=n;i++)
		er[i]=mul(er[i-1],2);
	int ans=0;
	for(int i=0;i<n;i++)
	{
		ans=add(ans,er[n-1]); // include
		// exclude
		for(int j=3;j<16;j++)
		{
			if(((j&1)&&(j&8)) || ((j&2)&&(j&4)))
			{
				//cout<<"!!! "<<j<<endl;
				int nans=1;
				for(int k=0;k<4;k++)
					if(j&(1<<k)) nans=mul(nans,er[cnt[i][k]]-1);
				//cout<<"!! "<<nans<<endl;
				ans=add(ans,nans);
			}
		}
		//cout<<ans<<endl;
	}
	printf("%d\n",ans);
	return 0;
}