using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
    long mod = 998244353;
    long answer = 0;
		long n = long.Parse(Console.ReadLine());
    long[][] vertexes = new long[n][];
    long[] twoPows = new long[200001];//2のk乗
    long twoPowMemo = 1;
    for(long i = 0; i <= 200000; i++)
    {
      twoPows[i] = twoPowMemo;
      twoPowMemo *= 2;//2のk乗を先にメモ
      twoPowMemo %= mod;
    }
    
    for(long i = 0; i < n; i++)
    {
      vertexes[i] = new long[2];
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
      vertexes[i][0] = nums[0];
      vertexes[i][1] = nums[1];
    }
    Array.Sort(vertexes, (a, b) => a[0].CompareTo(b[0]));

    long[,] yPositions = new long[n,2];
    for(long i = 0; i < n; i++)
    {
      yPositions[i,0] = vertexes[i][1];
      yPositions[i,1] = i;
    }
    yPositions = CoordinateCompression(yPositions);

    long[] leftUnder = new long[n];//左にある小さい数
    long[] rightUnder = new long[n];//右にある小さい数
    long[] leftMore = new long[n];
    long[] rightMore = new long[n];
    long[] bitsLeft = new long[n+1];
    long[] bitsRight = new long[n+1];

    for(long i = 0; i < n; i++)
    {
      BitAdd(bitsLeft, yPositions[i,2]+1, 1);
      leftUnder[i] = BitSum(bitsLeft, yPositions[i,2]);
      leftMore[i] = i-leftUnder[i];
    }

    for(long i = n-1; i >= 0; i--)
    {
      BitAdd(bitsRight, yPositions[i,2]+1, 1);
      rightUnder[i] = BitSum(bitsRight, yPositions[i,2]);
      rightMore[i] = (n-1-i)-rightUnder[i];
    }

    answer += twoPows[n-1]*n;
    answer %= mod;

    for(long i = 0; i < n; i++)
    { 
      long answerMemo = (twoPows[leftUnder[i]]-1)*(twoPows[rightMore[i]]-1);
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;

      answerMemo = (twoPows[leftMore[i]]-1)*(twoPows[rightUnder[i]]-1);
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;

      answerMemo = (twoPows[leftUnder[i]]-1)*(twoPows[rightMore[i]]-1);
      answerMemo %= mod;
      answerMemo *= twoPows[leftMore[i]]-1;
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;

      answerMemo = (twoPows[leftUnder[i]]-1)*(twoPows[rightMore[i]]-1);
      answerMemo %= mod;
      answerMemo *= twoPows[rightUnder[i]]-1;
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;

      answerMemo = (twoPows[leftMore[i]]-1)*(twoPows[rightUnder[i]]-1);
      answerMemo %= mod;
      answerMemo *= twoPows[leftUnder[i]]-1;
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;

      answerMemo = (twoPows[leftMore[i]]-1)*(twoPows[rightUnder[i]]-1);
      answerMemo %= mod;
      answerMemo *= twoPows[rightMore[i]]-1;
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;

      answerMemo = (twoPows[leftUnder[i]]-1)*(twoPows[rightMore[i]]-1);
      answerMemo %= mod;
      answerMemo *= twoPows[leftMore[i]]-1;
      answerMemo %= mod;
      answerMemo *= twoPows[rightUnder[i]]-1;
      answerMemo %= mod;
      answer += answerMemo;
      answer %= mod;
    }
    
		Console.WriteLine(answer);
	}

  static long[,] CoordinateCompression(long[,] vertexesOriginal)
    //1次元の座標圧縮。配列は0-indexで引数[x,順番]から[x,順番,圧縮x]を返す。
    //例えば、{2,4,4,3}は{0,2,2,1}を返す。
  {
    long n = vertexesOriginal.GetLength(0);//多次元配列の長さの取得
    long xCount = 1;//圧縮後のxの個数
    long[] compressedXmemo = new long[n];
    long[][] vertexes = new long[n][];
    for(long i = 0; i < n; i++)
    {
      vertexes[i] = new long[3];
      for(long j = 0; j < 2; j++)
      {
        vertexes[i][j] = vertexesOriginal[i,j];//配列をジャグ配列に置換
      }
    }

    Array.Sort(vertexes, (a, b) => a[0].CompareTo(b[0]));//x座標でソート
    vertexes[0][2] = 0;
    compressedXmemo[0] = vertexes[0][0];
    for(long i = 1; i < n; i++)
    {
      if(vertexes[i][0] == vertexes[i-1][0])//x座標が同じ
      {
        vertexes[i][2] = xCount - 1;
      }else
      {
        xCount++;
        vertexes[i][2] = xCount - 1;
        compressedXmemo[xCount-1] = vertexes[i][0];
      }
    }
    long[] compressedX = new long[xCount];
    for(long i = 0; i < xCount; i++) compressedX[i] = compressedXmemo[i];

    Array.Sort(vertexes, (a, b) => a[1].CompareTo(b[1]));//もとの番号順でソート

    long[,] answer = new long[n,3];
    for(long i = 0; i < n; i++)
    {
      for(long j = 0; j < 3; j++)
      {
        answer[i,j] = vertexes[i][j];//ジャグ配列から戻す
      }
    }

    return answer;//[x,順番,圧縮x]を返す。
  }

  static long[] BitAdd(long[] bits, long i, long x)//BITでiだけにx加算。O(logn)
  {
    long n = bits.Length-1;
    while(i <= n)
    {
      bits[i] += x;
      i += i&-i;
    }
    return bits;
  }

  static long BitSum(long[] bits, long i)//BITでi以下の総和を計算。O(logn)
  {
    long sum = 0;
    while(i > 0)
    {
      sum += bits[i];
      i -= i&-i;
    }
    return sum;
  }
  
}


Measured memory_bytes: 53764