### BUGGY CODE ###

import sys
input = sys.stdin.readline
mod = 998244353

def sub(a, b):
    return (a % mod + mod - b % mod) % mod

sys.setrecursionlimit(pow(10, 8))

def power(x, y):
    b = 0
    cs = []
    while True:
        if y == 0:
            r = 1
            break
        elif y == 1:
            r = x % mod
            break
        elif y % 2 == 0 :
            y = y // 2
            cs.append(0)
        else:
            y = (y-1)//2
            cs.append(1)
    for c in cs[::-1]:
        if c == 1:
            r = r ** 2 * x % mod
        else:
            r = r ** 2 % mod
    return r

class SegTree:
    def __init__(self, init_val, n, ide_ele, seg_func):
        self.segfunc = seg_func
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

def mm(a, b, c, d, n):
    return sub(power(2, b+c) + power(2, c+d) + power(2, d+a) + power(2, a+b),
                power(2, a) + power(2, b) + power(2, c) + power(2, d))

n, = list(map(int, input().split()))
ps, xs, ys = [], [], []
for _ in range(n):
    x, y = list(map(int, input().split()))
    xs.append(x)
    ys.append(y)
for i, xi in enumerate(sorted(list(range(n)), key=lambda x:xs[x])):
    xs[xi] = i 
for i, yi in enumerate(sorted(list(range(n)), key=lambda x:ys[x])):
    ys[yi] = i 
for x, y in zip(xs, ys):
    ps.append((x,y))
ps = sorted(ps, key=lambda x:x[0])

ss1 = SegTree([0] * n, n, 0, lambda x,y:x+y)
#ss2 = SegTree([1] * n, n, 0, lambda x,y:x+y)

r = 0
for p in ps:
    ss1.update(p[1], 1)
#    ss2.update(p[1], 0)
    d = ss1.query(0, p[1])
    c = p[0] - d
    b = (n-1) - p[1] - c
#    a = ss2.query(0, p[1])
    a = (n-1) - b - c - d
    r = (r + mm(a, b, c, d, n)) % mod

print(sub((power(2, n) * n) % mod, (r+n)%mod))


### FIXED CODE ###

import sys
input = sys.stdin.readline
mod = 998244353

def sub(a, b):
    return (a % mod + mod - b % mod) % mod

n, = list(map(int, input().split()))
t = 1
dd = [t]
for _ in range(n):
    t=2*t%mod
    dd.append(t)

def power(a, b):
    return dd[b]

class SegTree:
    def __init__(self, init_val, n, ide_ele, seg_func):
        self.segfunc = seg_func
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

def mm(a, b, c, d, n):
    return sub(power(2, b+c) + power(2, c+d) + power(2, d+a) + power(2, a+b),
                power(2, a) + power(2, b) + power(2, c) + power(2, d))

xs, ys = [], []
for _ in range(n):
    x, y = list(map(int, input().split()))
    xs.append(x)
    ys.append(y)

ini = sorted(list(range(n)), key=lambda x:xs[x])
for i, yi in enumerate(sorted(list(range(n)), key=lambda x:ys[x])):
    ys[yi] = i 
nys = [ys[i] for i in ini]

ss1 = SegTree([0] * n, n, 0, lambda x,y:x+y)
r = 0
for i, y in enumerate(nys):
    ss1.update(y, 1)
    d = ss1.query(0, y)
    c = i - d
    b = (n-1) - y - c
    a = (n-1) - b - c - d
    r = (r + mm(a, b, c, d, n)) % mod

print(sub((power(2, n) * n) % mod, (r+n)%mod))