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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (998244353LL)

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<pair<int, int>> P(N);
    for (int n = 0; n < N; ++n) {
        int x, y;
        cin >> x >> y;
        P[n] = {x, y};
    }
    sort(P.begin(), P.end());
    vector<int> Ind(N);
    iota(Ind.begin(), Ind.end(), 1);
    sort(Ind.begin(), Ind.end(), [&](int l, int r){return P[l-1].second < P[r-1].second;});
    
    vector<vector<int>> A(4, vector<int>(N));
    vector<int> BIT(N+1);
    auto Add = [&](int n) {
        while (n <= N) {
            ++BIT[n];
            n += n&-n;
        }
    };
    auto Sum = [&](int n) {
        int s = 0;
        while (n > 0) {
            s += BIT[n];
            n -= n&-n;
        }
        return s;
    };
    for (int n = 0; n < N; ++n) {
        int nSum = Sum(Ind[n]);
        A[0][n] = n-nSum;
        A[1][n] = nSum;
        Add(Ind[n]);
    }
    BIT.assign(N+1, 0);
    for (int n = N-1; n >= 0; --n) {
        int nSum = Sum(Ind[n]);
        A[2][n] = nSum;
        A[3][n] = (N-1-n)-nSum;
        Add(Ind[n]);
    }
    
    vector<ll> Pow2(N+1);
    Pow2[0] = 1;
    for (int n = 1; n <= N; ++n) Pow2[n] = (Pow2[n-1]<<1) % MOD;
    ll Res = 0;
    for (int n = 0; n < N; ++n) {
        ll Tmp = Pow2[N] - 1;
        for (int k = 0; k < 4; ++k) {
            Tmp = (Tmp - Pow2[A[k][n]+A[(k+1)%4][n]]) % MOD;
            Tmp = (Tmp + Pow2[A[k][n]]) % MOD;
        }
        Res = (Res + Tmp) % MOD;
    }
    cout << (Res + MOD) % MOD << endl;

    return 0;
}