#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <utility>
#define llint long long
#define mod 998244353

using namespace std;
typedef pair<llint, llint> P;

struct BIT{
	int size;
	vector<int> bit;
	BIT(){size = 0;}
	BIT(int s){
		size = s;
		bit.resize(size+1);
		init();
	}
	void init(){
		for(int i = 1; i <= size; i++) bit[i] = 0;
	}
	int query(int i){
		int ret = 0;
		while(i > 0){
			ret += bit[i];
			i -= i&(-i);
		}
		return ret;
	}
	void add(int i, int x){
		while(i <= size){
			bit[i] += x;
			i += i&(-i);
		}
	}
};

llint n, k;
llint x[200005], y[200005];
llint u[200005], l[200005];
llint lu[200005], rd[200005]; 
vector<llint> compX, compY;
vector<pair<P, llint> > vecX, vecY;
BIT bit(200005);

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void comp(llint x[], vector<llint> &vec)
{
	for(int i = 1; i <= n; i++) vec.push_back(x[i]);
	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());
	for(int i = 1; i <= n; i++) x[i] = lower_bound(vec.begin(), vec.end(), x[i]) - vec.begin() + 1;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> x[i] >> y[i];
	comp(x, compX), comp(y, compY);
	
	for(llint i = 1; i <= n; i++){
		vecX.push_back(make_pair(make_pair(x[i], y[i]), i));
		vecY.push_back(make_pair(make_pair(y[i], x[i]), i));
	}
	sort(vecX.begin(), vecX.end());
	sort(vecY.begin(), vecY.end());
	
	for(int i = 0; i < vecY.size(); i++){
		bit.add(vecY[i].first.second, 1);
		lu[vecY[i].second] = bit.query(vecY[i].first.second);
	}
	bit.init();
	for(int i = (int)vecY.size()-1; i >= 0; i--){
		bit.add(vecY[i].first.second, 1);
		rd[vecY[i].second] = bit.query(n) - bit.query(vecY[i].first.second-1);
	}
	
	/*for(int i = 1; i <= n; i++){
		cout << x[i] << " " << y[i] << " " << lu[i] << " " << rd[i] << endl;
	}*/
	
	llint ans = 0;
	for(llint i = 1; i <= n; i++){
		ans += modpow(2, n-1), ans %= mod;
		
		llint tmp = 0, cnt;
		u[i] = cnt = lower_bound(vecY.begin(), vecY.end(), make_pair(make_pair(y[i], 0LL), 0LL)) - vecY.begin();
		tmp += modpow(2, cnt), tmp %= mod;
		cnt = n - (lower_bound(vecY.begin(), vecY.end(), make_pair(make_pair(y[i]+1, 0LL), 0LL)) - vecY.begin());
		tmp += modpow(2, cnt), tmp %= mod;
		
		l[i] = cnt = lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], 0LL), 0LL)) - vecX.begin();
		tmp += modpow(2, cnt), tmp %= mod;
		cnt = n - (lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i]+1, 0LL), 0LL)) - vecX.begin());
		tmp += modpow(2, cnt), tmp %= mod;
		
		lu[i] -= lower_bound(vecY.begin(), vecY.end(), make_pair(make_pair(y[i], x[i]), i)) - lower_bound(vecY.begin(), vecY.end(), make_pair(make_pair(y[i], 0LL), 0LL));
		lu[i] -= lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], y[i]), i)) - lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], 0LL), 0LL));
		lu[i] -= 1;
		tmp += mod - modpow(2, lu[i]), tmp %= mod;
		
		rd[i] -= lower_bound(vecY.begin(), vecY.end(), make_pair(make_pair(y[i]+1, 0LL), 0LL)) - lower_bound(vecY.begin(), vecY.end(), make_pair(make_pair(y[i], x[i]), i)) - 1;
		rd[i] -= lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i]+1, 0LL), 0LL)) - lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], y[i]), i)) - 1;
		rd[i] -= 1;
		tmp += mod - modpow(2, rd[i]), tmp %= mod;
		
		//cout << x[i] << " " << y[i] << " " << lu[i] << " " << rd[i] << " " << u[i] << " " << l[i] << endl;
		
		cnt = u[i] - lu[i];
		cnt -= lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], y[i]), i)) - lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], 0LL), 0LL));
		tmp += mod - modpow(2, cnt), tmp %= mod;
		
		cnt = l[i] - lu[i];
		cnt -= lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], y[i]), i)) - lower_bound(vecX.begin(), vecX.end(), make_pair(make_pair(x[i], 0LL), 0LL));
		tmp += mod - modpow(2, cnt), tmp %= mod;
		
		ans += modpow(2, n-1) - tmp + mod, ans %= mod;
	}
	
	/*for(int i = 1; i <= n; i++){
		cout << x[i] << " " << y[i] << " " << u[i] << " " << l[i] << endl;
	}*/
	
	ans += mod - n, ans %= mod;
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 24800