#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

class Add_Segment_Tree {
	vector<long long int>v;
	vector<int>l;
	vector<int>r;
	long long int ret;
	int num;
	long long int Update(int place) {
		if (place >= v.size() / 2) {
			return v[place];
		}
		v[place] = Update(place * 2) + Update(place * 2 + 1);
		return v[place];
	}
	void Sum(int a, int b, int place) {
		if (l[place] >= a && r[place] <= b) {
			ret += v[place];
			return;
		}
		if (l[place] > b || r[place] < a) return;
		Sum(a, b, place * 2);
		Sum(a, b, place * 2 + 1);
		return;
	}
public:
	void Left(int place) {
		if (place >= v.size() / 2) {
			l[place] = place - v.size() / 2;
			return;
		}
		Left(place * 2);
		Left(place * 2 + 1);
		l[place] = l[place * 2];
		return;
	}
	void Right(int place) {
		if (place >= v.size() / 2) {
			r[place] = place - v.size() / 2;
			return;
		}
		Right(place * 2);
		Right(place * 2 + 1);
		r[place] = r[place * 2 + 1];
		return;
	}
	Add_Segment_Tree(int n) {
		n++;
		num = 1;
		while (num < n * 2)num *= 2;
		l.resize(num);
		r.resize(num);
		v.resize(num, 0);
		Left(1);
		Right(1);
	}
	void Add(int place, long long int num, bool update) {
		place += v.size() / 2;
		v[place] += num;
		if (!update)return;
		place /= 2;
		while (place) {
			v[place] = v[place * 2] + v[place * 2 + 1];
			place /= 2;
		}
	}
	void TopDown() {
		Update(1);
	}
	long long int Sum(int a, int b) {
		ret = 0;
		Sum(a, b, 1);
		return ret;
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<int>x(N);
	vector<int>y(N);
	map<int, int>mx;
	map<int, int>my;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		mx[x[i]] = 0;
		my[y[i]] = 0;
	}
	int cnt = 0;
	for (auto &i : mx) {
		i.second = cnt++;
	}
	cnt = 0;
	for (auto &i : my) {
		i.second = cnt++;
	}
	for (auto &i : x)i = mx[i];
	for (auto &i : y)i = my[i];
	vector<int>two(N + 1, 0);
	for (int i = 1; i <= N; i++) {
		two[i] = two[i - 1] * 2 + 1;
		two[i] %= MOD;
	}
	vector<pair<int, int>>place(N);
	for (int i = 0; i < N; i++)place[i] = { x[i],y[i] };
	sort(place.begin(), place.end());
	long long int ret = 0;
	Add_Segment_Tree asg(N);
	for (int i = 0; i < N; i++) {
		long long int ans = 0;
		ans += two[place[i].first];
		ans %= MOD;
		ans += two[place[i].second];
		ans %= MOD;
		ans += two[N - 1 - place[i].first];
		ans %= MOD;
		ans += two[N - 1 - place[i].second];
		ans %= MOD;
		int dsum = asg.Sum(0, place[i].second);
		int usum = asg.Sum(place[i].second, N);
		ans += MOD - two[dsum];
		ans %= MOD;
		ans += MOD - two[usum];
		ans %= MOD;
		dsum = place[i].second - dsum;
		usum = N - place[i].second - 1 - usum;
		ans += MOD - two[dsum];
		ans %= MOD;
		ans += MOD - two[usum];
		ans %= MOD;
		asg.Add(place[i].second, 1, true);
		ret += two[N]- ans + MOD;
		ret %= MOD;
	//	cout << ans << endl;
	}
	cout << ret << endl;
}


Measured memory_bytes: 33024