#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define pb push_back
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p = mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 60; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------
struct A {
	int x, y;
	bool operator<(A a) { return x + y < a.x + a.y; }
};
class BIT {
	int size;
	int dat[500000];
public:
	BIT() {}
	void init(int n) {
		size = n;
		for (int i = 1; i <= n; i++) dat[i] = 0;
	}
	void add(int i, int x) {
		i++;
		while (i <= size) {
			dat[i] += x;
			i += i & -i;
		}
	}//0-indexed
	int query(int i) {
		i++;
		int sum = 0;
		while (i > 0) {
			sum += dat[i];
			i -= i & -i;
		}
		return sum;
	}//0-indexed
};//size, 0-indexed
int n;
A a[200000];
vector<int>x, y;
BIT bx, by;
int res;
int tat(int n) {
	return mod_pow(2, n, Mod) - 1;
}
int solve(int i) {
	int k = a[i].x;
	int r = a[i].y;
	int o = bx.query(a[i].x) + by.query(a[i].y) - res;
	return tat(k) + tat(r) + tat(n - k - 1) + tat(n - r - 1) - tat(o) - tat(k - o) - tat(r - o) - tat(n - (k + 1 + r - o));
}
signed main() {
	cin >> n;
	bx.init(n); by.init(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].x >> a[i].y;
		x.push_back(a[i].x);
		y.push_back(a[i].y);
	}
	sort(all(x)); sort(all(y));
	sort(a, a + n);
	rep(i, n) {
		a[i].x = lower_bound(all(x), a[i].x) - x.begin();
		a[i].y = lower_bound(all(y), a[i].y) - y.begin();
	}
	int ans = 0;
	for (int i = 0; i < n; ) {
		res = i;
		int j = i;
		while (j < n && a[i].x + a[i].y == a[j].x + a[j].y) {
			ans += mod_pow(2, n, Mod) - 1 - solve(j);
			ans %= Mod;
			j++;
		}
		for (; i < j; i++) {
			bx.add(a[i].x, 1);
			by.add(a[i].y, 1);
		}
	}
	cout << (ans + Mod) % Mod << endl;
}

Measured memory_bytes: 14052