output_description: Print the sum of f(T) over all non-empty subset T of S, modulo 998244353.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      x_1 y_1
      :
      x_N y_N
attempt: def f_encolsed_points(MOD=998244353):
      # 参考: https://atcoder.jp/contests/abc136/submissions/6696160
      import sys
  
      input = sys.stdin.readline
  
      class BIT(object):
          """Binary Indexed Tree (1-indexed)"""
  
          def __init__(self, n):
              self.size = n
              self.tree = [0] * (n + 1)
  
          def sum(self, index):
              """tree[1]からtree[index]までの和を計算"""
              ret = 0
              while index > 0:
                  ret += self.tree[index]
                  index -= index & (-index)
              return ret
  
          def add(self, index, value=1):
              """tree[index]にvalueを加算"""
              while index <= self.size:
                  self.tree[index] += value
                  index += index & (-index)
  
      N = int(input())
      Pos = [[int(i) for i in input().split()] for j in range(N)]
  
      Pos.sort()  # x座標でソートする
      _, pos_y = zip(*Pos)
      y_comp = {y: i for i, y in enumerate(sorted(pos_y), 1)}  # y座標を圧縮
  
      pow_2 = [1]
      for _ in range(N):
          pow_2.append(pow_2[-1] * 2 % MOD)
  
      ans = 0
      tree = BIT(N)
      # x座標が小さな点から順に考える
      for left, (_x, _y) in enumerate(Pos):
          y = y_comp[_y]
  
          # それぞれ、注目している点の 右|下|上 にいくつ点が存在するか
          right = N - 1 - left
          down = y - 1
          up = N - 1 - down
  
          lower_left = tree.sum(y)
          tree.add(y, 1)
          upper_left = left - lower_left
          lower_right = down - lower_left
          upper_right = right - lower_right
  
          # 包除原理(全体 - 上下左右 + 左上左下右上右下 - それ自体)
          count = (
              pow_2[N]
              - (pow_2[up] + pow_2[down] + pow_2[left] + pow_2[right])
              + (
                  pow_2[upper_left]
                  + pow_2[lower_left]
                  + pow_2[upper_right]
                  + pow_2[lower_right]
              )
              - 1
          )
          ans += count
          ans %= MOD
      return ans
  
  
  print(f_encolsed_points())
  
problem_description: Statement
  
  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.
samples: [{"input": "3\n    -1 3\n    2 1\n    3 -2", "output": "13\n    \n\nLet the first, second, and third points be P_1, P_2, and P_3, respectively. S\n= \\\\{P_1, P_2, P_3\\\\} has seven non-empty subsets, and f has the following\nvalues for each of them:\n\n  * f(\\\\{P_1\\\\}) = 1\n  * f(\\\\{P_2\\\\}) = 1\n  * f(\\\\{P_3\\\\}) = 1\n  * f(\\\\{P_1, P_2\\\\}) = 2\n  * f(\\\\{P_2, P_3\\\\}) = 2\n  * f(\\\\{P_3, P_1\\\\}) = 3\n  * f(\\\\{P_1, P_2, P_3\\\\}) = 3\n\nThe sum of these is 13.\n\n* * *"}, {"input": "4\n    1 4\n    2 1\n    3 3\n    4 2", "output": "34\n    \n\n* * *"}, {"input": "10\n    19 -11\n    -3 -12\n    5 3\n    3 -15\n    8 -14\n    -9 -20\n    10 -9\n    0 2\n    -7 17\n    6 -6", "output": "7222\n    \n\nBe sure to print the sum modulo 998244353."}]