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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}


template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

	ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

	ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<998244353>;

template<class T>
struct  BinaryIndexedTree{
	int n;
	vector<T>dat;

	BinaryIndexedTree(int n=0):n(n),dat(n+1){}

	void add(int k,T x){
		for(k++;k<=n;k+=k&-k)dat[k]+=x;
	}
	T sum(int k){
		T ret{};
		for(k++;k;k-=k&-k)ret+=dat[k];
		return ret;
	}
};


int N;
int X[222222],Y[222222];

int cnt[222222][4];
mint po[222222];
signed main(){
	po[0]=1;
	for(int i=1;i<222222;i++)po[i]=po[i-1]*2;

	cin>>N;
	vint xs,ys;
	rep(i,N){
		cin>>X[i]>>Y[i];
		xs.pb(X[i]);
		ys.pb(Y[i]);
	}
	sort(all(xs));sort(all(ys));
	rep(i,N){
		X[i]=lower_bound(all(xs),X[i])-xs.begin();
		Y[i]=lower_bound(all(ys),Y[i])-ys.begin();
	}

	vint ord(N);iota(all(ord),0);
	sort(all(ord),[&](int i,int j){
		return X[i]<X[j];
	});

	BinaryIndexedTree<int>bit(N+114);
	rep(i,N){
		int k=ord[i];
		int tmp=bit.sum(Y[k]);
		cnt[k][0]=i-tmp;
		cnt[k][3]=tmp;
		bit.add(Y[k],1);
	}
	bit=BinaryIndexedTree<int>(N+114);
	for(int i=N-1;i>=0;i--){
		int k=ord[i];
		int tmp=bit.sum(Y[k]);
		cnt[k][1]=(N-1-i)-tmp;
		cnt[k][2]=tmp;
		bit.add(Y[k],1);
	}

	mint ans=0;
	rep(i,N){
		mint tmp=po[N]-1;
		rep(j,4)tmp-=(po[cnt[i][j]+cnt[i][(j+1)%4]]-1);
		rep(j,4)tmp+=(po[cnt[i][j]]-1);
		ans+=tmp;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 19428