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 JAVA):

Solution:
import java.util.*;

public class Main {

    static int N;
    static int mod = 998244353;
    static long[] bit_right;
    static long[] bit_left;

    static long pow(long a,long n) {
        long res=1;
        while (n>0) {
            if ((n-n/2*2)==1) {
                res=res*a%mod;
            }
            a=a*a%mod;
            n>>=1;
        }
        return res;
    }

    static void add_left(int index, long val) {
        for (int i=index;i<=N;i+=(i&(-i))) {
            bit_left[i] += val;
        }
    }

    static long sum_left(int index) {
        long tmp = 0L;
        for (int i=index;i>0;i-=(i&(-i))) {
            tmp += bit_left[i];
        }
        return tmp;
    }

    static void add_right(int index, long val) {
        for (int i=index;i<=N;i+=(i&(-i))) {
            bit_right[i] += val;
        }
    }

    static long sum_right(int index) {
        long tmp = 0L;
        for (int i=index;i>0;i-=(i&(-i))) {
            tmp += bit_right[i];
        }
        return tmp;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        bit_left = new long[N+1];
        bit_right = new long[N+1];
        int[] x = new int[N];
        int[] y = new int[N];
        TreeSet<Integer> set_right = new TreeSet<Integer>();
        TreeSet<Integer> set_left = new TreeSet<Integer>();
        for (int i=0;i<N;i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            set_right.add(x[i]);
            set_left.add(y[i]);
        }
        ArrayList<Integer> list_right = new ArrayList<Integer>(set_right);
        ArrayList<Integer> list_left = new ArrayList<Integer>(set_left);
        for (int i=0;i<N;i++) {
            x[i] = Collections.binarySearch(list_right, x[i])+1;
            y[i] = Collections.binarySearch(list_left, y[i])+1;
            add_right(y[i], 1);
        }

        ArrayList<int[]> list = new ArrayList<int[]>();
        for (int i=0;i<N;i++) {
            int[] add = {x[i], y[i]};
            list.add(add);
        }

        Collections.sort(list, (o1, o2)->Integer.compare(o1[0], o2[0]));

        long[] pow_2 = new long[N+1];
        pow_2[0] = 1;
        for (int i=0;i<N;i++) {
            pow_2[i+1] = pow_2[i]*2;
            if (pow_2[i+1]>=mod) pow_2[i+1]-=mod;
        }

        // System.out.println(Arrays.toString(x));
        // System.out.println(Arrays.toString(y));

        long ans = 0L;
        for (int i=0;i<N;i++) {
            int xx = list.get(i)[0];
            int yy = list.get(i)[1];

            add_left(yy, 1);
            add_right(yy, -1);

            long quadrant_2 = sum_left(N)-sum_left(yy);
            long quadrant_3 = sum_left(yy-1);

            long quadrant_1 = sum_right(N)-sum_right(yy);
            long quadrant_4 = sum_right(yy-1);

            // System.out.println("quadrant: "+quadrant_1+" "+quadrant_2+" "+quadrant_3+" "+quadrant_4+" ");
            // System.out.println(ans);
            // ans = (ans+2*pow(2, N-1)-1-pow(2, quadrant_1+quadrant_2)-pow(2, quadrant_2+quadrant_3)-pow(2, quadrant_3+quadrant_4)-pow(2, quadrant_4+quadrant_1)
                       // +pow(2, quadrant_1)+pow(2, quadrant_2)+pow(2, quadrant_3)+pow(2, quadrant_4)+4*(long)mod)%mod;

            ans = (ans+2*pow_2[N-1]-1-pow_2[(int)quadrant_1+(int)quadrant_2]-pow_2[(int)quadrant_2+(int)quadrant_3]-pow_2[(int)quadrant_3+(int)quadrant_4]-pow_2[(int)quadrant_4+(int)quadrant_1]
                       +pow_2[(int)(int)quadrant_1]+pow_2[(int)quadrant_2]+pow_2[(int)quadrant_3]+pow_2[(int)quadrant_4]+4*(long)mod)%mod;

        }
        System.out.println(ans);
    }
}