atcoder#ABC136F. [ABC136F] Enclosed Points

[ABC136F] Enclosed Points

Score : 600600 points

Problem Statement

We have a set SS of NN points in a two-dimensional plane. The coordinates of the ii-th point are (xi,yi)(x_i, y_i). The NN points have distinct xx-coordinates and distinct yy-coordinates.

For a non-empty subset TT of SS, let f(T)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 TT. More formally, we define f(T)f(T) as follows:

  • f(T):=f(T) := (the number of integers ii (1iN)(1 \leq i \leq N) such that axiba \leq x_i \leq b and cyidc \leq y_i \leq d, where aa, bb, cc, and dd are the minimum xx-coordinate, the maximum xx-coordinate, the minimum yy-coordinate, and the maximum yy-coordinate of the points in TT)

Find the sum of f(T)f(T) over all non-empty subset TT of SS. Since it can be enormous, print the sum modulo 998244353998244353.

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 109xi,yi109-10^9 \leq x_i, y_i \leq 10^9
  • xixj(ij)x_i \neq x_j (i \neq j)
  • yiyj(ij)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:

NN

x1x_1 y1y_1

::

xNx_N yNy_N

Output

Print the sum of f(T)f(T) over all non-empty subset TT of SS, modulo 998244353998244353.

3
-1 3
2 1
3 -2
13

Let the first, second, and third points be P1P_1, P2P_2, and P3P_3, respectively. S={P1,P2,P3}S = \{P_1, P_2, P_3\} has seven non-empty subsets, and ff has the following values for each of them:

  • f({P1})=1f(\{P_1\}) = 1
  • f({P2})=1f(\{P_2\}) = 1
  • f({P3})=1f(\{P_3\}) = 1
  • f({P1,P2})=2f(\{P_1, P_2\}) = 2
  • f({P2,P3})=2f(\{P_2, P_3\}) = 2
  • f({P3,P1})=3f(\{P_3, P_1\}) = 3
  • f({P1,P2,P3})=3f(\{P_1, P_2, P_3\}) = 3

The sum of these is 1313.

4
1 4
2 1
3 3
4 2
34
10
19 -11
-3 -12
5 3
3 -15
8 -14
-9 -20
10 -9
0 2
-7 17
6 -6
7222

Be sure to print the sum modulo 998244353998244353.