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:
# Enclosed Points
import bisect
from collections import defaultdict


class SegTree():
    # 1-indexed
    def __init__(self, N, function, basement):
        self.n = N
        self.K = (self.n-1).bit_length()
        self.f = function
        self.b = basement
        self.seg = [basement]*(2**(self.K+1)+1)
        X = 2**self.K

    def update(self, k, value):
        X = 2**self.K
        k += X
        self.seg[k] += value
        while k:
            k = k >> 1
            self.seg[k] = self.f(self.seg[k << 1], self.seg[(k << 1) | 1])

    def query(self, L, R):
        num = 2**self.K
        L += num
        R += num
        vL = self.b
        vR = self.b
        while L < R:
            if L & 1:
                vL = self.f(vL, self.seg[L])
                L += 1
            if R & 1:
                R -= 1
                vR = self.f(self.seg[R], vR)
            L >>= 1
            R >>= 1
        return self.f(vL, vR)


def aggfunc(x, y):
    return x+y


def Press(lists):
    lists.sort()
    d = defaultdict(int)
    now = -float("inf")
    index = 0
    for i in range(len(lists)):
        if lists[i] > now:
            index += 1
            d[lists[i]] = index
            now = lists[i]
        elif lists[i] == now:
            d[lists[i]] = index
    return d


mod = 998244353
N = int(input())
Point = []
for i in range(N):
    x, y = map(int, input().split())
    Point.append((x, y, i))


def modifie():
    Point.sort(key=lambda x: (x[1], x[0]))
    X = []
    for x, y, i in Point:
        X.append(x)
    modified_point_x = Press(X)
    return modified_point_x


modified_point_x = modifie()
segtree = SegTree(N+1, aggfunc, 0)
below_below = defaultdict(int)

for i in range(N):
    x, y, index = Point[i]
    segtree.update(modified_point_x[x], 1)
    below_below[Point[i]] = segtree.query(0, modified_point_x[x]+1)

X, Y = [], []
for x, y, index in Point:
    X.append(x)
    Y.append(y)
X.sort()
Y.sort()

ans = 0
powers = [1 for i in range(3*10**5)]
for i in range(1, 3*10**5):
    powers[i] = powers[i-1]*2 % mod


def pows(K):
    return powers[K]


for i in range(N):
    x, y, index = Point[i]
    ZZ = below_below[Point[i]]-1
    XX = bisect.bisect_right(X, x)-ZZ-1
    WW = bisect.bisect_right(Y, y)-ZZ-1
    YY = N-1-XX-ZZ-WW
    ss = pow(2, N, mod)-1-pows(XX)-pows(YY)-pows(ZZ)-pows(WW)+4-(pows(XX)-1)*(pows(YY)-1) - \
        (pows(YY)-1)*(pows(WW)-1)-(pows(ZZ)-1) * \
        (pows(WW)-1)-(pows(ZZ)-1)*(pows(XX)-1)
    ans += ss
print(ans % mod)