#include <cstdio>
#include <cassert>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

typedef long long i64;

struct BIT {

	vector<int> data;
	int size;

	void init(int n)
	{
		size = n;
		data.resize(size + 1);
		fill(data.begin(), data.end(), 0);
	}

	void add(int pos, int x)
	{
		pos += 1;
		while(pos < size + 1) {
			data[pos] += x;
			pos += pos & -pos;
		}
	}

	int sum(int pos)
	{
		pos += 1;
		int s = 0;
		while(pos > 0) {
			s += data[pos];
			pos -= pos & -pos;
		}
		return s;
	}
};

const i64 mod = 998244353;

i64 modpow2(i64 x)
{
	i64 a = 1;
	i64 k = 2;

	for(int i = 0; i < 62; i++) {
		if((x >> i) & 1) {
			a = a * k % mod;
		}
		k = k * k % mod;
	}

	return a;
}

int main()
{
	int n;
	vector<pair<int, int>> ps;
	vector<int> xs, ys;

	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		ps.push_back({x, y});
		xs.push_back(x);
		ys.push_back(y);
	}

	sort(xs.begin(), xs.end());
	sort(ys.begin(), ys.end());

	for(int i = 0; i < n; i++) {
		int ox = ps[i].first, oy = ps[i].second;
		int x = lower_bound(xs.begin(), xs.end(), ox) - xs.begin();
		int y = lower_bound(ys.begin(), ys.end(), oy) - ys.begin();
		ps[i] = {x, y};
	}

	i64 ans = 0;
	BIT bit;

	sort(ps.begin(), ps.end());
	bit.init(n);

	for(int i = 0; i < n; i++) {

		int x = ps[i].first;
		int y = ps[i].second;

		int xl = x, xr = n - 1 - x;
		int yl = y, yr = n - 1 - y;
		int xlyl = bit.sum(y);
		int xlyr = i - xlyl;
		int xryl = yl - xlyl;
		int xryr = yr - xlyr;

		assert(xlyl + xlyr == xl);
		assert(xryl + xryr == xr);

		bit.add(y, 1);

		i64 a = 0;

		a += modpow2(n) - 1;
		a -= modpow2(xl) - 1;
		a -= modpow2(xr) - 1;
		a -= modpow2(yl) - 1;
		a -= modpow2(yr) - 1;
		a += modpow2(xlyl) - 1;
		a += modpow2(xlyr) - 1;
		a += modpow2(xryl) - 1;
		a += modpow2(xryr) - 1;
		a += 5 * mod;

		ans = (a + ans) % mod;

		//printf("%d (%d,%d) -> %d + %d + %d + %d, %lld\n", i, x, y, xlyl, xlyr, xryl, xryr, a);
	}

	printf("%lld\n", ans);

	return 0;
}
