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 <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <math.h>
#include <string>
#include <math.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;

const ll mod = 998244353;
const ll INF = 1000000000000;
ll N, a[200010], b[200010], c[200010], d[200010], x[200010], y[200010], bit[200010], Y_Coordinates[200010], ans;
vector<ll> X_Order, Y_Order;
map<ll, ll> X_Compression, Y_Compression;

ll pow_mod(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2 == 1)
	{
		return pow_mod(x, y - 1) * x % mod;
	}
	else
	{
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= N)
	{
		bit[i] += x;
		i += i & -i;
	}
}

int main()
{
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		cin >> x[i] >> y[i];
		X_Order.push_back(x[i]);
		Y_Order.push_back(y[i]);
	}

	sort(X_Order.begin(), X_Order.end());
	sort(Y_Order.begin(), Y_Order.end());

	for (int i = 0; i < N; i++)
	{
		X_Compression[X_Order[i]] = i + 1;
		Y_Compression[Y_Order[i]] = i + 1;
	}

	for (int i = 1; i <= N; i++)
	{
		x[i] = X_Compression[x[i]];
		y[i] = Y_Compression[y[i]];
		Y_Coordinates[x[i]] = y[i];
	}

	for (int i = 1; i <= N; i++)
	{
		a[i] = sum(Y_Coordinates[i]);
		b[i] = i - 1 - a[i];
		add(Y_Coordinates[i], 1);
	}
	
	for (int i = 0; i <= N + 1; i++)
	{
		bit[i] = 0;
	}

	for (int i = N; i >= 1; i--)
	{
		c[i] = sum(Y_Coordinates[i]);
		d[i] = N - i - c[i];
		add(Y_Coordinates[i], 1);
	}

	for (int i = 1; i <= N; i++)
	{
		(ans += pow_mod(2, N) - 1) %= mod;
		(ans += mod - pow_mod(2, a[i] + b[i]) + 1) %= mod;
		(ans += mod - pow_mod(2, b[i] + d[i]) + 1) %= mod;
		(ans += mod - pow_mod(2, c[i] + d[i]) + 1) %= mod;
		(ans += mod - pow_mod(2, c[i] + a[i]) + 1) %= mod;
		(ans += pow_mod(2, a[i]) - 1) %= mod;
		(ans += pow_mod(2, b[i]) - 1) %= mod;
		(ans += pow_mod(2, c[i]) - 1) %= mod;
		(ans += pow_mod(2, d[i]) - 1) %= mod;
	}

	cout << ans << endl;

	int www;
	cin >> www;
}