#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=998244353;
struct node
{
    int x,y;
    bool operator<(const node&o)const
    {
        return x<o.x;
    }
}a[N];
int n,t[N],hs[N];
ll lu[N],ld[N],ru[N],rd[N];
ll f[N];
void add(int x)
{
    while(x<=n)
        t[x]++,x+=x&-x;
}
int query(int x)
{
    int ans=0;
    while(x) ans+=t[x],x-=x&-x;return ans;
}
int main()
{
    f[0]=1;
    for(int i=1;i<N;i++)
        f[i]=f[i-1]*2%mod;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y),hs[i]=a[i].y;
    sort(a+1,a+1+n);
    sort(hs+1,hs+1+n);
    for(int i=1;i<=n;i++)
        a[i].y=lower_bound(hs+1,hs+1+n,a[i].y)-hs;
    for(int i=1;i<=n;i++)
    {
        ld[i]=query(a[i].y);
        lu[i]=i-1-ld[i];
        add(a[i].y);
    }
    memset(t,0,sizeof(t));
    for(int i=n;i>=1;i--)
    {
        rd[i]=query(a[i].y);
        ru[i]=n-i-rd[i];
        add(a[i].y);
    }
    ll ans=0;
	for(int i=1;i<=n;++i)
    {
		ans=(ans+f[n-1])%mod;//选了点i
		ans=(ans+f[n-1])%mod;//没选点i
		ans=(ans-f[lu[i]+ld[i]]-f[ru[i]+rd[i]]-f[lu[i]+ru[i]]-f[ld[i]+rd[i]])%mod;//减去不合法的
        ans=(ans+f[lu[i]]+f[ru[i]]+f[ld[i]]+f[rd[i]])%mod;//加上重复减的
        ans=(ans-1)%mod;//减去全没选的情况
	}
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
}
