#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>


using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353LL;

struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

template<typename T>
struct BIT {
	int n;
	vector<T> bit;
	BIT() :n(0) {}
	BIT(int _n) :n(_n) { bit = vector<T>(n + 1); }
	void add1(int idx, T val) {
		for (int i = idx; i <= n; i += i & -i) bit[i] += val;
	}
	T sum1(int idx) {
		T res = 0;
		for (int i = idx; i > 0; i -= i & -i) res += bit[i];
		return res;
	}
	//0-indexed
	void add(int idx, T val) { add1(idx + 1, val); }
	//0-indexed [left, right)
	T sum(int left, int right) { return sum1(right) - sum1(left); }

	int lower_bound(T x) {
		int res = 0;
		int k = 1;
		while (2 * k <= n) k <<= 1;
		for (; k > 0; k >>= 1) {
			if (res + k <= n and bit[res + k] < x) {
				x -= bit[res + k];
				res += k;
			}
		}
		return res;
	}
};

template<typename T>
struct Compress {
	vector<T> v;
	Compress() {}
	Compress(vector<T> _v) :v(_v) {
		sort(v.begin(), v.end());
		v.erase(unique(v.begin(), v.end()), v.end());
	}

	void build(vector<T> _v) {
		v = _v;
		sort(v.begin(), v.end());
		v.erase(unique(v.begin(), v.end()), v.end());
	}
	int get(T x) {
		return lower_bound(v.begin(), v.end(), x) - v.begin();
	}

	T& operator[](int i) { return v[i]; }


	int size() {
		return (int)v.size();
	}
};

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n; cin >> n;
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	{
		vector<pair<int, int>> vp(n); for (int i = 0; i < n; i++) vp[i].first = x[i], vp[i].second = y[i];
		sort(vp.begin(), vp.end()); for (int i = 0; i < n; i++) x[i] = vp[i].first, y[i] = vp[i].second;
		Compress<int> cx(x), cy(y);
		for (int i = 0; i < n; i++) x[i] = cx.get(x[i]), y[i] = cy.get(y[i]);
	}

	BIT<ll> b1(n), b2(n);
	for (int i = 0; i < n; i++) b2.add(y[i], 1);
	vector<mint> tw(n + 1); tw[0] = 1; for (int i = 1; i <= n; i++) tw[i] = tw[i - 1] * 2;
	mint res = 0;
	//for (int i = 0; i < n; i++) cout << "x: " << x[i] << " y: " << y[i] << endl;
	for (int i = 0; i < n; i++) {
		b2.add(y[i], -1);
		mint t = 0;
		ll c1 = b2.sum(y[i], n);
		ll c2 = b1.sum(y[i], n);
		ll c3 = b1.sum(0, y[i]);
		ll c4 = b2.sum(0, y[i]);
		t += (tw[c1] - 1) * (tw[c2] - 1) * (tw[c3] - 1) * (tw[c4] - 1);
		t += (tw[c1] - 1) * (tw[c2] - 1) * (tw[c3] - 1);
		t += (tw[c1] - 1) * (tw[c2] - 1) * (tw[c4] - 1);
		t += (tw[c2] - 1) * (tw[c3] - 1) * (tw[c4] - 1);
		t += (tw[c1] - 1) * (tw[c3] - 1) * (tw[c4] - 1);
		t += (tw[c1] - 1) * (tw[c3] - 1);
		t += (tw[c2] - 1) * (tw[c4] - 1);
		res += t + tw[n - 1];
		b1.add(y[i], 1);
	}
	cout << res.x << "\n";
	return 0;
}

Measured memory_bytes: 9524