#include <bits/stdc++.h>
using namespace std;

using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt{
    fint64 x;
    ModInt():x(0){}
    ModInt(fint64 x):
        x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
        {}
    // 負号
    ModInt operator -() const{
        return ModInt(-x);
    }
    // 加算
    ModInt &operator +=(const ModInt &rhs){
        x+=rhs.x;
        if(x>=MOD) x-=MOD;
        return (*this);
    }
    ModInt operator +(const ModInt &rhs) const{
        return ModInt(*this)+=rhs;
    }
    // 減算
    ModInt &operator -=(const ModInt &rhs){
        x+=MOD-rhs.x;
        if(x>=MOD) x-=MOD;
        return (*this);
    }
    ModInt operator -(const ModInt &rhs) const{
        return ModInt(*this)-=rhs;
    }
    // 乗算
    ModInt &operator *=(const ModInt &rhs){
        x*=rhs.x;
        if(x>=MOD) x%=MOD;
        return (*this);
    }
    ModInt operator *(const ModInt &rhs) const{
        return ModInt(*this)*=rhs;
    }
    // 除算
    ModInt &operator /=(const ModInt &rhs){
        (*this)*=rhs.inverse();
        return (*this);
    }
    ModInt operator /(const ModInt &rhs) const{
        return ModInt(*this)/=rhs;
    }
    // 等号
    bool operator ==(const ModInt &rhs){
        return x==rhs.x;
    }
    bool operator !=(const ModInt &rhs){
        return x!=rhs.x;
    }
    // 累乗
    ModInt pow(fint64 n) const{
        fint64 tmp=x;
        fint64 ret=1;
        while(n>0){
            if(n&1) ret=ret*tmp%MOD;
            tmp=tmp*tmp%MOD;
            n>>=1ll;
        }
        return ModInt(ret);
    }
    // 逆元
    ModInt inverse() const{
        fint64 a=x,b=MOD,s=1,t=0;
        while(b>0){
            fint64 u=a/b;
            a-=u*b;
            s-=u*t;
            swap(a,b);
            swap(s,t);
        }
        return ModInt(s);
    }
    // 入出力
    friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
        fint64 x; lhs>>x;
        rhs=ModInt<MOD>(x);
        return lhs;
    }
    friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
        return lhs<<rhs.x;
    }
};

template<class T>
struct SegmentTree {
	using F = function<T(T, T)>;
	const T init;
	const F f;
	int sz;
	vector<T> seg;
	SegmentTree(int n, const T init, const F f) :
		init(init),
		f(f)
		{
			sz = 1;
			while(sz < n) sz <<= 1;
			seg.resize(sz << 1, init);
		}
	void update(int id) {
		while(id >>= 1) {
			seg[id] = f(seg[2 * id], seg[2 * id + 1]);
		}
	}
	void replace(int id, T x){
		id += sz;
		seg[id] = x;
		update(id);
	}
	// [l,r)
	T get(int l, int r){
		T L = init, R = init;
		for(l += sz, r += sz; l < r; l >>= 1, r>>= 1) {
			if(l & 1) L = f(L, seg[l++]);
			if(r & 1) R = f(seg[--r], R);
		}
		return f(L, R);
	}
	void debug(){
		int i = 1;
		for(int r = 2; r <= 2 * sz; r <<= 1) {
			while(i < r) {
				cout << seg[i++] << " ";
			}
			cout << "\n";
		}
	}
};

const int64_t MOD = 998244353;
using mint = ModInt<MOD>;
int main() {
	int n; cin >> n;
	map<int, int> X;
	pair<int, int> xpoint[n];
	pair<int, int> ypoint[n];
	for(int i = 0; i < n; ++i) {
		int x, y; cin >> x >> y;
		xpoint[i] = {x, y};
		ypoint[i] = {y, x};
	}
	sort(xpoint, xpoint + n);
	sort(ypoint, ypoint + n);
	for(int i = 0; i < n; ++i) {
		X[xpoint[i].first] = i;
	}
	int t[n][4] = {};
	SegmentTree<int> segsmall(n, 0, [](int a, int b){return a+b;});
	for(int i = 0; i < n; ++i) {
		int x, y;
		tie(y, x) = ypoint[i];
		x = X[x];
		t[i][2] = segsmall.get(0, x);
		t[i][3] = i - t[i][2];
		segsmall.replace(x, 1);
	}
	SegmentTree<int> seglarge(n, 0, [](int a, int b){return a + b;});
	for(int i = n - 1; i >= 0; --i) {
		int x, y;
		tie(y, x) = ypoint[i];
		x = X[x];
		t[i][1] = seglarge.get(0, x);
		t[i][0] = (n - 1 - i) - t[i][1];
		seglarge.replace(x, 1);
	}
	mint ans = 0;
	for(int i = 0; i < n; ++i) {
		for(int mask = 0; mask < (1 << 4); ++mask) {
			mint tmp = 1;
			for(int j = 0; j < 4; ++j) {
				if(mask >> j & 1) {
					mint x = 2;
					tmp *= x.pow(t[i][j]) - 1;
				}
			}
			const int _02 = 0b0101;
			const int _13 = 0b1010;
			if((mask & _02) == _02 or (mask & _13) == _13) {
				tmp *= 2;
			}
			ans += tmp;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 19968