package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	xx := make([]int, n)
	yy := make([]int, n)
	pp := make(Points, n)
	doubling := Doubling{}
	doubling.init()
	for i := 0; i < n; i++ {
		pp[i].x = getNextInt(scanner)
		pp[i].y = getNextInt(scanner)
		xx[i] = pp[i].x
		yy[i] = pp[i].y
	}

	sort.Sort(pp)
	sort.Ints(xx)
	sort.Ints(yy)

	xr := map[int]int{}
	yr := map[int]int{}
	for i := 0; i < n; i++ {
		xr[xx[i]] = i
		yr[yy[i]] = i
	}

	var ans int64
	seg := Segment{}
	seg.init(n)

	wholecnt := doubling.count(n) - 1

	for i := 0; i < n; i++ {
		seg.add(yr[pp[i].y], 1)
		// 左下にある個数
		ld := seg.rangesum(0, yr[pp[i].y])
		// 左上にある個数
		lu := seg.rangesum(yr[pp[i].y]+1, n)
		// 右下にある個数
		rd := yr[pp[i].y] - ld
		// 右上にある個数
		ru := n - 1 - rd - ld - lu

		current := int64(0)

		// 左にあるもの加算
		current += doubling.count(ld+lu) - 1
		// 右にあるもの加算
		current += doubling.count(rd+ru) - 1
		// 上にあるもの加算
		current += doubling.count(lu+ru) - 1
		// 下にあるもの加算
		current += doubling.count(ld+rd) - 1
		// 左下にあるもの減算
		current -= doubling.count(ld) - 1
		// 左上にあるもの減算
		current -= doubling.count(lu) - 1
		// 右下にあるもの減算
		current -= doubling.count(rd) - 1
		// 右上にあるもの減算
		current -= doubling.count(ru) - 1

		ans += wholecnt - current
		ans %= doubling.mod
		ans = (ans + doubling.mod) % doubling.mod
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}

type Doubling struct {
	d   []int64
	mod int64
}

func (doubling *Doubling) init() {
	doubling.mod = int64(998244353)
	doubling.d = make([]int64, 31)
	doubling.d[0] = 2
	for i := 1; i < 31; i++ {
		doubling.d[i] = doubling.d[i-1] * doubling.d[i-1]
		doubling.d[i] %= doubling.mod
	}
}
func (doubling *Doubling) count(c int) int64 {
	var a int64
	a = 1
	for i := 0; i < 31; i++ {
		if c>>uint(i)&1 == 0 {
			continue
		}
		a *= doubling.d[i]
		a %= doubling.mod
	}
	return a
}

type Point struct {
	x, y int
}

type Points []Point

func (a Points) Len() int           { return len(a) }
func (a Points) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Points) Less(i, j int) bool { return a[i].x < a[j].x }

// Segment ...
type Segment struct {
	n, h, i, chunk int
	unit           []int
	bucket         [][]int
}

func (seg *Segment) init(n int) {
	seg.n = n
	seg.unit = make([]int, 1)
	seg.unit[0] = 1
	seg.bucket = make([][]int, 1)
	seg.bucket[0] = make([]int, n)

	chunk := 8
	for i := 0; n > 1; i++ {
		n = (n-1)/chunk + 1
		seg.bucket = append(seg.bucket, make([]int, n))
		seg.unit = append(seg.unit, seg.unit[i]*chunk)
	}
	seg.h = len(seg.unit)
	seg.chunk = chunk
}
func (seg *Segment) add(index, value int) {
	for i := 0; i < seg.h; i++ {
		seg.bucket[i][index/seg.unit[i]] += value
	}
}
func (seg *Segment) rangeadd(l, r, value int) {
	i := 0
	for index := l; index < r; index += seg.unit[i] {
		for i < seg.h-1 && index%seg.unit[i+1] == 0 {
			i++
		}
		for index+seg.unit[i] > r {
			i--
		}
		ii := index / seg.unit[i]
		seg.bucket[i][ii] += value
	}
}
func (seg *Segment) rangesum(l, r int) int {
	var sum int
	i := 0
	for index := l; index < r; index += seg.unit[i] {
		for i < seg.h-1 && index%seg.unit[i+1] == 0 {
			i++
		}
		for index+seg.unit[i] > r {
			i--
		}
		ii := index / seg.unit[i]
		sum += seg.bucket[i][ii]
	}

	return sum
}


Measured memory_bytes: 30848