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"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 998244353;
const long long inf = 1ll << 61;
const double eps = 0.000000000001;
typedef pair<int, int> P;
typedef pair<P, int>PP;
struct edge { int to; int cost;};
int x[200006], y[200006];
vector<PP>V,V2;
int ans[4][200006];
int bit[200007];
int N;
int sum(int i) {
	int s = 0;
	while (i > 0) {
		s += bit[i];
		i -= i&-i;
	}
	return s;
}
void add(int i, int x) {
	while (i <= N) {
		bit[i] += x;
		i += i&-i;
	}
}

int modpow(int x, int n, int mod) {
	if (!n)return 1;
	int res = modpow(x*x%mod, n / 2, mod);
	if (n & 1)res = res*x%mod;
	return res;
}

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> x[i] >> y[i];
	map<int, int>M1, M2;
	rep(i, n)M1[x[i]]++;
	int cnt = 0;
	for (auto itr = M1.begin(); itr != M1.end(); itr++) {
		M2[itr->first] = cnt;
		cnt++;
	}
	map<int, int>M3, M4;
	rep(i, n)M3[y[i]]++;
	cnt = 0;
	for (auto itr = M3.begin(); itr != M3.end(); itr++) {
		M4[itr->first] = cnt;
		cnt++;
	}

	rep(i, n) {
		V.push_back(PP(P(M2[x[i]], M4[y[i]]),i));
	}
	sort(V.begin(), V.end());
	N = n;

	rep(i, n)add(V[i].first.second + 1, 1);
	rep(i, n) {
		ans[0][V[i].second] = sum(V[i].first.second);
		ans[1][V[i].second] = n-i-1-ans[0][V[i].second];
		add(V[i].first.second + 1, -1);
	}
	fill(bit, bit + 200004, 0);

	rep(i, n)add(V[i].first.second + 1, 1);
	for(int i=n-1;i>=0;i--) {
		ans[2][V[i].second] = sum(V[i].first.second);
		ans[3][V[i].second] = i - ans[2][V[i].second];
		add(V[i].first.second + 1, -1);
	}

	int sum = n*modpow(2, n - 1, mod);
	rep(i, n) {
		int S0 = modpow(2, ans[0][i], mod);
		int S1 = modpow(2, ans[1][i], mod);
		int S2 = modpow(2, ans[2][i], mod);
		int S3 = modpow(2, ans[3][i], mod);
		sum += (S0-1)*(S3-1)%mod;
		sum += (S1-1)*(S2-1)%mod;
		sum += (S0 - 1)*(S3 - 1)%mod*(S1 + S2 - 2) % mod;
		sum += (S1 - 1)*(S2 - 1)%mod*(S0 + S3 - 2) % mod;
		sum += (S0 - 1)*(S1 - 1) % mod*(S2 - 1) % mod*(S3 - 1) % mod;
		sum %= mod;
	}
	cout << sum << endl;
}