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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			String[] sa = br.readLine().split(" ");
			x[i] = Integer.parseInt(sa[0]);
			y[i] = Integer.parseInt(sa[1]);
		}
		br.close();

		zaatu(x);
		zaatu(y);
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.x = x[i];
			o.y = y[i];
			arr[i] = o;
		}
		Arrays.sort(arr, (o1, o2) -> o1.x - o2.x);

		int[] lol = new int[n];
		int[] hil = new int[n];
		BIT bit = new BIT(n);
		for (int i = 0; i < n; i++) {
			lol[i] = bit.sum(arr[i].y);
			hil[i] = i - lol[i];
			bit.add(arr[i].y, 1);
		}

		int[] lor = new int[n];
		int[] hir = new int[n];
		bit = new BIT(n);
		for (int i = 0; i < n; i++) {
			int ri = n - 1 - i;
			lor[ri] = bit.sum(arr[ri].y);
			hir[ri] = i - lor[ri];
			bit.add(arr[ri].y, 1);
		}

		int mod = 998244353;
		long ans = n * power(2, n - 1, mod) % mod;
		for (int i = 0; i < n; i++) {
			long val1 = power(2, lol[i], mod);
			long val2 = power(2, hil[i], mod);
			long val3 = power(2, lor[i], mod);
			long val4 = power(2, hir[i], mod);
			long val11 = (val1 - 1 + mod) % mod;
			long val21 = (val2 - 1 + mod) % mod;
			long val31 = (val3 - 1 + mod) % mod;
			long val41 = (val4 - 1 + mod) % mod;
			ans += val11 * val21 % mod * val31 % mod * val41 % mod;
			ans += val11 * val21 % mod * val31 % mod;
			ans += val11 * val21 % mod * val41 % mod;
			ans += val11 * val31 % mod * val41 % mod;
			ans += val21 * val31 % mod * val41 % mod;
			ans += val11 * val41 % mod;
			ans += val21 * val31 % mod;
			ans %= mod;
		}
		System.out.println(ans);
	}

	static long power(long x, long n, int m) {
		if (n == 0) {
			return 1;
		}
		long val = power(x, n / 2, m);
		val = val * val % m;
		if (n % 2 == 1) {
			val = val * x % m;
		}
		return val;
	}

	static void zaatu(int[] a) {
		TreeMap<Integer, Integer> map = new TreeMap<>();
		for (int i = 0; i < a.length; i++) {
			map.put(a[i], null);
		}
		Integer[] arr = map.keySet().toArray(new Integer[0]);
		int cnt = 0;
		for (Integer i : arr) {
			cnt++;
			map.put(i, cnt);
		}
		for (int i = 0; i < a.length; i++) {
			a[i] = map.get(a[i]);
		}
	}

	static class BIT {
		int n;
		int[] arr;

		public BIT(int n) {
			this.n = n;
			arr = new int[n + 1];
		}

		void add(int idx, int val) {
			for (int i = idx; i <= n; i += i & -i) {
				arr[i] += val;
			}
		}

		int sum(int idx) {
			int sum = 0;
			for (int i = idx; i > 0; i -= i & -i) {
				sum += arr[i];
			}
			return sum;
		}
	}

	static class Obj {
		int x, y;
	}
}