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

Solution:
import sys
from operator import itemgetter

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


class BinaryIndexedTree:
    # 1-indexed
    def __init__(self, n):
        self.n = n
        self.data = [0] * (n + 1)
    
    def add(self, _i, x):
        i = _i
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    
    def sum(self, _i):
        i = _i
        res = 0
        while i:
            res += self.data[i]
            i -= i & -i
        return res
    
    def bisect_left(self, _w):
        w = _w
        if w <= 0:
            return 0
        i = 0
        k = 1 << (self.n.bit_length() - 1)
        while 0 < k:
            if i + k <= self.n and self.data[i + k] < w:
                w -= self.data[i + k]
                i += k
            k = k >> 1
        return i + 1


def solve():
    MOD = 998244353
    N = int(rl())
    xy = [[0, 0] for _ in range(N)]
    for i in range(N):
        xy[i][0], xy[i][1] = map(int, rl().split())
    
    compress = sorted(xy, key=itemgetter(1))
    for i in range(N):
        compress[i][1] = i
    compress.sort(key=itemgetter(0), reverse=True)
    
    bit = BinaryIndexedTree(N)
    ups = [0] * N
    downs = [0] * N
    for i in range(N):
        com = compress[i][1] + 1
        downs[N - 1 - i] = bit.sum(com)
        ups[N - 1 - i] = i - downs[N - 1 - i]
        bit.add(com, 1)
    
    bit = BinaryIndexedTree(N)
    compress = compress[::-1]
    
    pow_of_2 = [1]
    for _ in range(N):
        pow_of_2.append(pow_of_2[-1] * 2 % MOD)
    
    ans = 0
    for i in range(N):
        com = compress[i][1] + 1
        d = bit.sum(com)
        u = i - d
        ans = (ans + (pow_of_2[d] - 1) * (pow_of_2[ups[i]] - 1) * pow_of_2[u + downs[i]]) % MOD
        ans = (ans + (pow_of_2[u] - 1) * (pow_of_2[downs[i]] - 1) * pow_of_2[d + ups[i]]) % MOD
        ans = (ans - (pow_of_2[d] - 1) * (pow_of_2[ups[i]] - 1) * (pow_of_2[downs[i]] - 1) * (pow_of_2[u] - 1)) % MOD
        ans = (ans + pow_of_2[N - 1]) % MOD
        bit.add(com, 1)
    print(ans)


if __name__ == '__main__':
    solve()