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<algorithm>
#include<iostream>

using namespace std;

const long long int N = 200005;
const long long int MOD = 998244353;
long long int x[N], y[N];
long long int power[N];
int tree[N][2];
int revert[N];

struct block{
  long long int value;
  int index;
};

bool compare(block Block1, block Block2){
  return Block1.value < Block2.value;
}

block x_block[N], y_block[N];

void update(int val, int index, int k, int n){
  while(index <=n){
    tree[index][k] += val;
    index += index & (-index);
  }
}

int query(int index, int k){
  int sum = 0;
  while(index > 0){
    sum += tree[index][k];
    index -= index & (-index);
  }

  return sum;
}

int main(){
  int n;
  long long int sum = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i){
    cin >> x[i] >> y[i];
    x_block[i].value = x[i];
    x_block[i].index = i;
    y_block[i].value = y[i];
    y_block[i].index = i;
  }

  sort(x_block + 1, x_block + n + 1, compare);
  sort(y_block + 1, y_block + n + 1, compare);

  for (int i = 1; i <= n; ++i){
      revert[y_block[i].index] = i;
  }


  power[0] = 1;
  for (int i = 1; i <=n; ++i){
    update(1, i, 1, n);
    power[i] = power[i - 1] * 2 % MOD;
  }

  for (int i = 1; i <=n; ++i){
    int index = revert[x_block[i].index];
    update(-1, index, 1, n);
    int zone3 = query(index, 0);
    int zone2 = i - 1 - zone3;

    int zone4 = query(index, 1);
    int zone1 = n - i - zone4;
    update(1, index, 0, n);

    sum = (sum + power[n - 1]) % MOD;
    sum = (sum + (((power[zone1] - 1) * (power[zone3] - 1) % MOD) * power[zone2] % MOD) * power[zone4] % MOD) % MOD;
    sum = (sum + (((power[zone2] - 1) * (power[zone4] - 1) % MOD) * power[zone1] % MOD) * power[zone3] % MOD) % MOD;
    sum = (sum + MOD - (((power[zone1] - 1) * (power[zone3] - 1) % MOD) * (power[zone2] - 1) % MOD) * (power[zone4] - 1) % MOD) % MOD;
  }

  cout << sum <<endl;
  return 0;
}