#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 998244353;
constexpr ll modsize = 200010;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

constexpr int RSQ = 1;
constexpr int RMQ = 2;
constexpr int RmQ = 3;

template<class T> class segtree {
	int n, mode;
	vector<T> data;
	T id;
public:
	segtree(int _n, int _mode) {
		n = 1;
		mode = _mode;
		while (n < _n + 2) n <<= 1;
		if (mode == 1) id = 0;
		else if (mode == 2) id = -INF;
		else if (mode == 3) id = INF;
		data = vector<T>(2 * n, id);
	}
	T operation(T a, T b) {
		if (mode == 1) return a + b;
		else if (mode == 2) return max(a, b);
		else if (mode == 3) return min(a, b);
	}
	void change(int i, T x) {
		i += n;
		data[i] = x;
		while (i > 1) {
			i >>= 1;
			data[i] = operation(data[i << 1], data[i << 1 | 1]);
		}
	}
	void add(int i, T x) { change(i, data[i + n] + x); }
	T get(int a, int b) {
		T left = id; T right = id;
		a += n; b += n;
		while (a < b) {
			if (a & 1) left = operation(left, data[a++]);
			if (b & 1) right = operation(data[--b], right);
			a >>= 1; b >>= 1;
		}
		return operation(left, right);
	}
	T get_all() { return data[1]; }
	T operator[](int i) { return data[i + n]; }
};

vector<int> shrink(vector<int> vec) {
	int vecsize = vec.size();
	vector<int> tmpvec = vec;
	sort(tmpvec.begin(), tmpvec.end());
	tmpvec.erase(unique(tmpvec.begin(), tmpvec.end()), tmpvec.end());
	vector<int> res(vecsize);
	for (int i = 0; i < vecsize; i++) res[i] = lower_bound(tmpvec.begin(), tmpvec.end(), vec[i]) - tmpvec.begin();
	return res;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	int n;
	cin >> n;
	vector<int> x(n), y(n);
	rep(i, n) cin >> x[i] >> y[i];
	x = shrink(x); y = shrink(y);
	vector<P> p(n);
	rep(i, n) {
		p[i].first = x[i];
		p[i].second = y[i];
	}
	sort(all(p));
	rep(i, n) {
		x[i] = p[i].first;
		y[i] = p[i].second;
	}
	vector<int> c1(n), c2(n), c3(n), c4(n);
	segtree<int> seg1(n, RSQ);
	rep(i, n) {
		c1[i] = seg1.get(y[i] + 1, n + 1);
		c3[i] = seg1.get(0, y[i]);
		seg1.add(y[i], 1);
	}
	segtree<int> seg2(n, RSQ);
	for (int i = n - 1; i >= 0; i--) {
		c2[i] = seg2.get(y[i] + 1, n + 1);
		c4[i] = seg2.get(0, y[i]);
		seg2.add(y[i], 1);
	}
	ll ans = modpow(2, n - 1)*n%mod;
	rep(i, n) {
		ans += (modpow(2, c1[i]) - 1)*(modpow(2, c4[i]) - 1) % mod*modpow(2, c2[i]) % mod*modpow(2, c3[i]) % mod;
		ans += (modpow(2, c2[i]) - 1)*(modpow(2, c3[i]) - 1) % mod*modpow(2, c1[i]) % mod*modpow(2, c4[i]) % mod;
		ans -= (modpow(2, c1[i]) - 1)*(modpow(2, c4[i]) - 1) % mod*(modpow(2, c2[i]) - 1) % mod*(modpow(2, c3[i]) - 1) % mod;
	}
	cout << (ans % mod + mod) % mod << '\n';
}

Measured memory_bytes: 16848