//バグあるかも
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(998244353)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(123456789)
#define LINF (long long int)(123456789012345678)
#define MAX_V 1000
#define all(v) v.begin(), v.end()

const int MAX_N = 1 << 20;
/*
//葉の数
int N;
ll A[2 * MAX_N - 1];

void init(int n_){
	N = 1;
	while(N < n_) N *= 2;

	rep(i,2 * N - 1){
		A[i] = 0;
	}
}

//nodeに1を加算
//default: node, 0, N, 0
void update(ll node, int l, int r, int now){
	if(node < l || r <= node){
		return;
	}

	if(l <= node && node < r){
		A[now] += 1;
	}

	update(node, l, (l+r)/2, now*2+1);
	update(node, (l+r)/2, r, now*2+2);
	return;
}

ll sum(ll nl, ll nr, int l, int r, int now){

}*/

int N;
ll A[2 * MAX_N - 1];

ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1) * a % MOD;
	}
}

void init(int n_){
	N = 1;
	while(N < n_) N *= 2;

	rep(i,2 * N - 1){
		A[i] = 0;
	}
}

void update(int node){
	while(node <= N){
		A[node] += 1;
		node += node & -node;
	}
}

ll sum_n(int node){
	ll s = 0;
	while(node > 0){
		s += A[node];
		node -= node & -node;
	}
	return s;
}

struct pos{int id;ll x,y;};
vector<ll> hikaku[8];//d,u,l,r,dl,dr,ul,ur
vector<ll> taiou;

int main(void){
	int n;
	cin>>n;
	ll x,y;
	vector<pos> positions;
	rep(i,n){
		cin>>x>>y;
		positions.push_back(pos{i,x,y});
		rep(j,8){
			hikaku[j].push_back(0);
		}
		taiou.push_back(-1);
	}
	sort(all(positions), [](const pos &a, const pos &b) {
        return a.y < b.y;
    });
    rep(i,n){
    	int id = positions[i].id;
    	hikaku[0][id] = i;
    	hikaku[1][id] = n-1-i;
    	taiou[i] = positions[i].y;
    }

	sort(all(positions), [](const pos &a, const pos &b) {
        return a.x < b.x;
    });
    rep(i,n){
    	int id = positions[i].id;
    	hikaku[2][id] = i;
    	hikaku[3][id] = n-1-i;
    }
	init(n);
	rep(i,n){
		//ll x = positions[i].x;
		ll y = positions[i].y;
		int id = positions[i].id;
		int node = lower_bound(all(taiou), y) - taiou.begin();
		node++;
		update(node);
		ll sum_l = sum_n(node - 1);
		hikaku[4][id] = sum_l;
		hikaku[6][id] = i - sum_l;
	}
	init(n);
	REP(i,n){
		//ll x = positions[i].x;
		ll y = positions[i].y;
		int id = positions[i].id;
		int node = lower_bound(all(taiou), y) - taiou.begin();
		node++;
		update(node);
		ll sum_l = sum_n(node - 1);
		hikaku[5][id] = sum_l;
		hikaku[7][id] = (n-1-i) - sum_l;	
	}

	/*string names[8] = {"d","u","l","r","dl","dr","ul","ur"};
	rep(i,8){
		cout<<names[i]<<" ";
		rep(j,n){
			cout<<hikaku[i][j]<<" ";
		}
		cout<<endl;
	}*/

	ll ans = 0;
	rep(i, n){
		ans += mpow(2, n) - 1;
		ans %= MOD;
		rep(j, 4){
			ans -= mpow(2, hikaku[j][i]) - 1;
			ans += 2*MOD;
			ans %= MOD;
		}
		for(int j=4; j<8; j++){
			ans += mpow(2, hikaku[j][i]) - 1;
			ans %= MOD;
		}
		//cout<<ans<<" ";
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 33196