using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public struct Data
{
	public int Id;
	public int X;
	public int Y;

	public Data(int i, int x, int y)
	{
		Id = i;
		X = x;
		Y = y;
	}
}

public class F
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		var list = new List<Data>();
		for(int i = 0; i < N; i++)
			list.Add(new Data(i, GetInt(), GetInt()));

		list.Sort((a, b) => a.Y - b.Y);
		var dict = new Dictionary<int, int>();
		for(int i = 0; i < N; i++)
			dict[list[i].Y] = i;

		var cnt = new long[N, 4];
		list.Sort((a, b) => a.X - b.X);

		var stl = new SegmentTree<long>(N, 0, (a, b) => a + b);
		for(int i = 0; i < N; i++)
		{
			int id = list[i].Id;
			int pos = dict[list[i].Y];
			cnt[id, 0] = stl.Query(0, pos);
			cnt[id, 1] = stl.Query(pos + 1, N);
			stl.Update(pos, 1);
		}

		var str = new SegmentTree<long>(N, 0, (a, b) => a + b);
		for(int i = N - 1; i >= 0; i--)
		{
			int id = list[i].Id;
			int pos = dict[list[i].Y];
			cnt[id, 2] = str.Query(0, pos);
			cnt[id, 3] = str.Query(pos + 1, N);
			str.Update(pos, 1);
		}

		var comb = new ModInt[N, 4];
		for(int i = 0; i < N; i++)
		{
			for(int j = 0; j < 4; j++)
				comb[i, j] = ModInt.ModPow(new ModInt(2), new ModInt(cnt[i, j])) - 1;
		}

		var ans = new ModInt(0);
		for(int i = 0; i < N; i++)
		{
			for(int s = 0; s < 16; s++)
			{
				var tmp = new ModInt(1);
				for(int j = 0; j < 4; j++)
				{
					if(contains(s, j))
						tmp *= comb[i, j];
				}

				if(contains(s, 0) && contains(s, 3))
					ans += tmp * 2;
				else if(contains(s, 1) && contains(s, 2))
					ans += tmp * 2;
				else
					ans += tmp;
			}
		}
		WriteLine(ans.Val);
	}

	private bool contains(int s, int x) => ((s >> x) & 1) == 1;
}

public struct ModInt
{
	public long Mod { get; private set; }
	public long Val { get; private set; }

	public ModInt(long v)
	{
		// must initialize (default: Mod = 0)
		Mod = 998244353;
		Val = (v + Mod) % Mod;
	}

	public static ModInt operator+(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long tmp = x.Val + y.Val;
		if(tmp >= mod)
			tmp -= mod;
		return new ModInt(tmp);
	}

	public static ModInt operator-(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long tmp = x.Val;
		if(tmp < y.Val)
			tmp += mod;
		tmp -= y.Val;
		return new ModInt(tmp);
	}

	public static ModInt operator*(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		return new ModInt((x.Val * y.Val) % mod);
	}

	public static ModInt operator/(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long pow = mod - 2;
		long yy = y.Val;
		long inv = 1;
		while(pow > 0)
		{
			if((pow & 1) == 1)
				inv = (inv * yy) % mod;
			yy = (yy * yy) % mod;
			pow >>= 1;
		}
		return new ModInt((x.Val * inv) % mod);
	}

	public static ModInt ModPow(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long exp = y.Val;
		long xx = x.Val;
		long res = 1;
		while(exp > 0)
		{
			if((exp & 1) == 1)
				res = (res * xx) % mod;

			xx = (xx * xx) % mod;
			exp >>= 1;
		}
		return new ModInt(res);
	}

	public static ModInt operator+(ModInt x, long y) => x + new ModInt(y);
	public static ModInt operator-(ModInt x, long y) => x - new ModInt(y);
	public static ModInt operator*(ModInt x, long y) => x * new ModInt(y);
	public static ModInt operator/(ModInt x, long y) => x / new ModInt(y);
	public static ModInt operator++(ModInt x) => x + new ModInt(1);
	public static ModInt operator--(ModInt x) => x - new ModInt(1);
}

public class SegmentTree<T>
{
	private int N;
	private T INI;
	private Func<T, T, T> Func;
	private T[] dat;

	public SegmentTree(int n, T ini, Func<T, T, T> func)
	{
		N = 1;		
		while(N < n)
			N <<= 1;

		INI = ini;
		Func = func;
			
		dat = new T[2 * N - 1];
		for(int i = 0; i < 2 * N - 1; i++)
			dat[i] = INI;
	}

	public void Update(int k, T a)
	{
		k += N - 1;
		dat[k] = a;
		while(k > 0)
		{
			k = (k - 1) / 2;
			dat[k] = Func(dat[k * 2 + 1], dat[k * 2 + 2]);
		}
	}

	public T Query(int a, int b, int k = 0, int l = 0, int r = -1)
	{
		if(r == -1)
			r = N;

		if(r <= a || b <= l)
			return INI;

		if(a <= l && r <= b)
			return dat[k];
		else
		{
			T vl = Query(a, b, k * 2 + 1, l, (l + r) / 2);
			T vr = Query(a, b, k * 2 + 2, (l + r) / 2, r);
			return Func(vl, vr);
		}
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 52696