#include<bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}


struct Points2D {
	struct SegTree {
		int n;
		std::vector<int> data;
		SegTree (int n_) {
			for (n = 1; n < n_; n <<= 1);
			data.resize(n << 1);
		}
		void add(int i, int val) {
			for (i += n; i; i >>= 1) data[i] += val;
		}
		int sum(int l, int r) {
			int res = 0;
			for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
				if (r & 1) res += data[--r];
				if (l & 1) res += data[l++];
			}
			return res;
		}
	};
	std::vector<std::pair<int, int> > pts;
	struct Query {
		int x1;
		int x2;
		int y1;
		int y2;
		int *res;
	};
	std::vector<Query> queries;
	void add(std::pair<int, int> pt) { pts.push_back(pt); }
	void add(int x, int y) { pts.push_back({x, y}); }
	void query(Query query) { queries.push_back(query); }
	void query(int x1, int x2, int y1, int y2, int *res) { queries.push_back({x1, x2, y1, y2, res}); }
	void calculate() {
		std::vector<int> xs, ys;
		for (auto i : pts) xs.push_back(i.first), ys.push_back(i.second);
		std::sort(xs.begin(), xs.end());
		xs.erase(std::unique(xs.begin(), xs.end()), xs.end());
		std::sort(ys.begin(), ys.end());
		ys.erase(std::unique(ys.begin(), ys.end()), ys.end());
		for (auto &i : pts) {
			i.first = std::lower_bound(xs.begin(), xs.end(), i.first) - xs.begin();
			i.second = std::lower_bound(ys.begin(), ys.end(), i.second) - ys.begin();
		}
		for (auto &i : queries) {
			i.x1 = std::lower_bound(xs.begin(), xs.end(), i.x1) - xs.begin();
			i.x2 = std::lower_bound(xs.begin(), xs.end(), i.x2) - xs.begin();
			i.y1 = std::lower_bound(ys.begin(), ys.end(), i.y1) - ys.begin();
			i.y2 = std::lower_bound(ys.begin(), ys.end(), i.y2) - ys.begin();
		}
		
		int sz = queries.size();
		for (int i = 0; i < sz; i++) {
			*queries[i].res = 0;
			queries.push_back({queries[i].x1, queries[i].x2, queries[i].y2, 1, queries[i].res});
			queries[i].y2 = -1;
		}
		std::sort(pts.begin(), pts.end(), [] (auto &a, auto &b) { return a.second < b.second; });
		std::sort(queries.begin(), queries.end(), [] (Query &a, Query &b) { return a.y1 < b.y1; });
		int n = pts.size();
		int head = 0;
		SegTree tree(xs.size());
		for (auto &i : queries) {
			while (head < n && pts[head].second < i.y1) tree.add(pts[head++].first, 1);
			*i.res += i.y2 * tree.sum(i.x1, i.x2);
		}
	}
};

#define MOD 998244353
template<int mod>
struct ModInt{
	int x;
	ModInt():x(0){}
	ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}
	ModInt &operator^=(long long p){
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
	ModInt operator-()const{return ModInt(-x);}
	ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
	ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
	ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
	ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	ModInt operator^(long long p)const{return ModInt(*this)^=p;}
	bool operator==(const ModInt &p)const{return x==p.x;}
	bool operator!=(const ModInt &p)const{return x!=p.x;}
	explicit operator int() const { return x; }						   // added by QCFium
	ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
	ModInt inverse()const{
		int a=x,b=mod,u=1,v=0,t;
		while(b>0){
			t=a/b;
			a-=t*b;
			std::swap(a,b);
			u-=t*v;
			std::swap(u,v);
		}
		return ModInt(u);
	}
	friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
		return os<<p.x;
	}
	friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
		long long x;
		is>>x;
		a=ModInt<mod>(x);
		return (is);
	}
};
typedef ModInt<MOD> mint;


int main() {
	int n = ri();
	int x[n], y[n];
	Points2D points;
	for (int i = 0; i < n; i++) {
		x[i] = ri();
		y[i] = ri();
		points.add({x[i], y[i]});
	}
	mint n2[n + 1];
	n2[0] = 1;
	for (int i = 1; i <= n; i++) n2[i] = n2[i - 1] * 2;
	mint res = 0;
	int pl[n][8];
	for (int i = 0; i < n; i++) {
		res += n2[n] - 1;
		points.query({-1000000001, x[i], -1000000001, 1000000001, pl[i]});
		points.query({x[i] + 1, 1000000001, -1000000001, 1000000001, pl[i] + 1});
		points.query({-1000000001, 1000000001, y[i] + 1, 1000000001, pl[i] + 2});
		points.query({-1000000001, 1000000001, -1000000001, y[i], pl[i] + 3});
		points.query({-1000000001, x[i], -1000000001, y[i], pl[i] + 4});
		points.query({x[i] + 1, 1000000001, -1000000001, y[i], pl[i] + 5});
		points.query({-1000000001, x[i], y[i] + 1, 1000000001, pl[i] + 6});
		points.query({x[i] + 1, 1000000001, y[i] + 1, 1000000001, pl[i] + 7});
	}
	points.calculate();
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 8; j++) {
			if (j < 4) res -= n2[pl[i][j]];
			else res += n2[pl[i][j]];
		}
	}
	
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 110812