using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	class Pair{
		public int X,Y;
		public Pair(int x, int y){
			X = x; Y = y;
		}
	}
	public void Solve(){
		
		var h = new HashSet<int>();
		for(int i=0;i<N;i++){
			h.Add(X[i]);
			h.Add(Y[i]);
		}
		var hl = h.ToList();
		hl.Sort();
		var di = new Dictionary<int,int>();
		for(int i=0;i<hl.Count;i++){
			di.Add(hl[i], i);
		}
		for(int i=0;i<N;i++){
			X[i] = di[X[i]];
			Y[i] = di[Y[i]];
		}
		
		mlong[] Pow2 = new mlong[N + 1];
		Pow2[0] = 1;
		for(int i=1;i<=N;i++) Pow2[i] = Pow2[i-1] * 2;
		
		
		Pair[] P = new Pair[N];
		for(int i=0;i<N;i++){
			P[i] = new Pair(X[i], Y[i]);
		}
		
		Array.Sort(P, (p, q) => p.X.CompareTo(q.X));
		
		int M = di.Count + 10;
		var BT0 = new BIT(M + 10);
		var BT1 = new BIT(M + 10);
		for(int i=0;i<N;i++) BT1.Add(P[i].Y + 1, 1);
		
		mlong prob = 0;
		for(int i=0;i<N;i++){
			BT1.Add(P[i].Y + 1, -1);
			mlong p0 = Pow2[N-1];
			
			
			int[] cc = new int[4];
			cc[0] = BT0.Sum(P[i].Y);
			cc[1] = BT0.Sum(M) - cc[0];
			cc[2] = BT1.Sum(P[i].Y);
			cc[3] = BT1.Sum(M) - cc[2];
//Console.WriteLine(String.Join(" ",cc));
			for(int t=0;t<(1<<4);t++){
				if(((t & 0x9) == 0x9) || ((t & 0x6) == 0x6)){
					mlong cnt = 1;
					for(int j=0;j<4;j++){
						if((t >> j) % 2 == 0) continue;
						cnt *= (Pow2[cc[j]] - 1);
					}
//Console.WriteLine("t;{0}, cnt:{1}",t,cnt);				
					p0 += cnt;
				}
			}
			prob += p0;
//Console.WriteLine(p0);
			BT0.Add(P[i].Y + 1, 1);
		}
		
		Console.WriteLine(prob);
		
		
		
	}
	int N;
	int[] X,Y;
	public Sol(){
		N = ri();
		X = new int[N];
		Y = new int[N];
		for(int i=0;i<N;i++){
			var d = ria();
			X[i] = d[0];
			Y[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


class BIT{
	int MM;
	int n;
	int[] bit;
	public BIT(int n_){
		n = n_;
		MM = 1 << 2;
		while(MM < n * 2) MM <<= 1;
		bit = new int[MM + 1];
	}
	//1-origin!! [0, i);
	public void Add(int i, int x){
		while(i <= n){
			bit[i] += x;
			i += (i&-i);
		}
	}
	
	// i=>sum(a_1,...,a_i)
	// i=0 -> return 0;
	public int Sum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= (i&-i);
		}
		return s;
	}
}


struct mlong {
	const long mod = (long) 998244353;
	public const long Mod = mod;
	long V;
	
	public mlong(long _v = 0){
		V = _v;
	}
	
	public static mlong operator+(mlong a, mlong b){
		var v0 = a.V + b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator-(mlong a, mlong b){
		var v0 = mod + a.V - b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator*(mlong a, mlong b){
		var v0 = a.V * b.V; if(v0 >= mod) v0 %= mod;
		return new mlong(v0);
	}
	public static mlong operator/(mlong a, mlong b){
		var v0 = a.V * inv(b.V).V; if(v0 >= mod) v0 %= mod;
		return new mlong(v0);
	}
	
	
	public static mlong inv(long x){
		long a = 0, b = 0, c = 0;
		ExtGCD(x, mod, ref a, ref b, ref c);
		return (mlong)((a + mod) % mod);
	}
	
	public static void ExtGCD(long x, long y, ref long a, ref long b, ref long c){
		long r0 = x; long r1 = y;
		long a0 = 1; long a1 = 0;
		long b0 = 0; long b1 = 1;
		long q1, r2, a2, b2;
		while(r1 > 0){
			q1 = r0 / r1;
			r2 = r0 % r1;
			a2 = a0 - q1 * a1;
			b2 = b0 - q1 * b1;
			r0 = r1; r1 = r2;
			a0 = a1; a1 = a2;
			b0 = b1; b1 = b2;
		}
		c = r0;
		a = a0;
		b = b0;
	}
	
	public static mlong ModPow(mlong a, long k){
		if(k == 0) return (mlong) 1;
		if(a == 0) return (mlong) 0;
		mlong x = a;
		mlong ret = 1;
		while(k > 0){
			if(k % 2 == 1) ret *= x;
			x *= x;
			k >>= 1;
		}
		return ret;
	}
	
	
	public static bool operator == (mlong a, mlong b){
		 return a.Equals(b);
	}
	public static bool operator != (mlong a, mlong b){
		 return !(a == b);
	}
	
	public override bool Equals(System.Object obj){
		if(obj  ==  null) return false;
		mlong p  =  (mlong) obj;
		if((System.Object) p  ==  null) return false;
		return p.V  ==  V;
	}
	public override int GetHashCode(){
		return V.GetHashCode();
	}
	
	public static implicit operator mlong(long n){
		long v = n % mod; if(v < 0) v += mod;
		return new mlong(v);
	}
	public static implicit operator mlong(int n){
		long v = n % mod; if(v < 0) v += mod;
		return new mlong(v);
	}
	public static explicit operator long(mlong n){
		return n.V;
	}
	
	public override String ToString(){
		return V.ToString();
	}
	
	
}

Measured memory_bytes: 56252