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>
#define int long long
using namespace std;
const int MAXN=200010,P=998244353;
struct Po {
	int first,second,id;
}p[MAXN],tp[MAXN];
int n,cnt[MAXN][4];
long long ans;
bool cmp1 (Po a,Po b) {return a.first<b.first;}
long long qpow (int a,int b) {
	if (b<0) {return 0;}
	int res=1;
	while (b) {
		if (b&1) {res=(res*a)%P;}
		a=(a*a)%P;
		b>>=1; 
	}
	return res;
}
void merge (int l,int r) {
	if (l==r) {
		return;
	} else {
		int mid=(l+r)/2,k=l,i=l,j=mid+1;
		merge(l,mid);
		merge(mid+1,r);
		while (i<=mid&&j<=r) {
			if (p[i].second<p[j].second) {cnt[p[i].id][2]+=j-mid-1,cnt[p[i].id][3]+=r-j+1;tp[k++]=p[i++];
			} else {cnt[p[j].id][0]+=i-l,cnt[p[j].id][1]+=mid-i+1;tp[k++]=p[j++];}
		}
		while (i<=mid) {cnt[p[i].id][2]+=j-mid-1;tp[k++]=p[i++];}
		while (j<=r) {cnt[p[j].id][0]+=i-l;tp[k++]=p[j++];}
		for (int ii=l;ii<=r;ii++) {p[ii]=tp[ii];}
	}
	return;
}
long long calc (int x) {
	return ((((((((qpow(2,cnt[x][0])-1)*(qpow(2,cnt[x][3])-1))%P)*qpow(2,cnt[x][1]))%P)*qpow(2,cnt[x][2]))%P)+((((((qpow(2,cnt[x][0])*qpow(2,cnt[x][3]))%P)*(qpow(2,cnt[x][1])-1))%P)*(qpow(2,cnt[x][2])-1))%P)
	        -(((((((qpow(2,cnt[x][0])-1)*(qpow(2,cnt[x][1])-1))%P)*(qpow(2,cnt[x][2])-1))%P)*(qpow(2,cnt[x][3])-1))%P)+P)%P;
}
signed main () {
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) {scanf("%lld%lld",&p[i].first,&p[i].second);p[i].id=i;}
	sort(p+1,p+n+1,cmp1);
	merge(1,n);
	for (int i=1;i<=n;i++) {
		ans=(ans+calc(i)+P)%P;
		ans=(ans+qpow(2,n-1))%P;
	}
	printf("%lld\n",ans);
	return 0;
}