#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

const int MAXN = (int)2e5 + 777;
const int MOD  = 998244353;

int add(int x, int y) {
	return (x + y >= MOD ? x + y - MOD : x + y);
}

int sub(int x, int y) {
	return (x - y < 0 ? x - y + MOD : x - y);
}

int F[MAXN];

void F_clear() {
	memset(F, 0, sizeof(F));
}

void F_add(int pos, int delta) {
	for(; pos < MAXN; pos |= pos + 1) {
		F[pos] += delta;
	}
}

int F_get(int r) {
	int rez = 0;

	for(; r >= 0; r = (r & (r + 1)) - 1) {
		rez += F[r];
	}

	return rez;
}

int F_get(int l, int r) {
	return F_get(r) - F_get(l - 1);
}

pii pts[MAXN];
int LU[MAXN], RU[MAXN], LD[MAXN], RD[MAXN], n;
vector<int> ordx, ordy;
int layer[MAXN];
int pw2[MAXN];

void init() {
	pw2[0] = 1;

	for(int i = 1; i < MAXN; ++i) {
		pw2[i] = add(pw2[i - 1], pw2[i - 1]);
	}
}

void solve() {
	cin >> n;
	ordx.resize(n);
	ordy.resize(n);

	for(int i = 0; i < n; ++i) {
		cin >> pts[i].first >> pts[i].second;

		ordx[i] = pts[i].first;
		ordy[i] = pts[i].second;
	}

	sort(ordx.begin(), ordx.end());
	ordx.erase(unique(ordx.begin(), ordx.end()), ordx.end());

	sort(ordy.begin(), ordy.end());
	ordx.erase(unique(ordy.begin(), ordy.end()), ordy.end());

	for(int i = 0; i < n; ++i) {
		pts[i].first = lower_bound(ordx.begin(), ordx.end(), pts[i].first) - ordx.begin();
		pts[i].second = lower_bound(ordy.begin(), ordy.end(), pts[i].second) - ordy.begin();

		layer[pts[i].first] = i;
	}

	for(int x = 0; x < n; ++x) {
		int idx = layer[x];
		int y = pts[idx].second;

		LU[idx] = F_get(0, y - 1);
		RU[idx] = F_get(y + 1, MAXN - 1);

		F_add(y, 1);
	}

	F_clear();

	for(int x = n - 1; x >= 0; --x) {
		int idx = layer[x];
		int y = pts[idx].second;

		LD[idx] = F_get(0, y - 1);
		RD[idx] = F_get(y + 1, MAXN - 1);

		F_add(y, 1);
	}

	int answ = 0;

	for(int idx = 0; idx < n; ++idx) {
		DBG(idx + 1); DBG(LU[idx]); DBG(RU[idx]); DBG(LD[idx]); DBG(RD[idx]); SAY("");
		answ = add(answ, pw2[n - 1]);

		answ = sub(answ, pw2[LU[idx] + LD[idx]]);
		answ = sub(answ, pw2[RU[idx] + RD[idx]]);
		answ = sub(answ, pw2[LU[idx] + RU[idx]]);
		answ = sub(answ, pw2[LD[idx] + RD[idx]]);

		answ = add(answ, pw2[LU[idx]]);
		answ = add(answ, pw2[RU[idx]]);
		answ = add(answ, pw2[LD[idx]]);
		answ = add(answ, pw2[RD[idx]]);

		answ = sub(answ, 1);

		answ = add(answ, pw2[n - 1]);
	}

	cout << answ << '\n';
}

int main() {
	fast_io();

	init();
	solve();

	return 0;
}


Measured memory_bytes: 8832