#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10,mod=998244353;
void plusle(int &a,int b){
    a+=b;if(a>=mod)a-=mod; return;
}
void minun(int &a,int b){
    a-=b; if(a<0)a+=mod; return;
}
int add(int a,int b) {
  a+=b;
  return a>=mod?a-mod:a;
}
int sub(int a,int b) {
  a-=b;
  return a<0?a+mod:a;
}
int mul(int a,int b) {
  return (int)((long long)a*b%mod);
}
int power(int a,int b) {
  int res=1;
  while (b>0) {
    if (b&1) {
      res=mul(res,a);
    }
    a=mul(a,a);
    b>>=1;
  }
  return res;
}
struct BIT{
    vector<int> bit;
    int n;
    BIT(int _n){
            bit.resize(_n+5,0);
            n=_n+5;
    }
    void update(int idx,int val){
        for(;idx<n;idx+=(idx&(-idx)))
            bit[idx]+=val;
        return;
    }
    int get(int idx){
        int sum=0;
        for(;idx>0;idx-=(idx&(-idx)))
            sum+=bit[idx];
        return sum;
    }
    int get(int l,int r){
        return get(r)-get(l-1);
    }
};
struct pt{
    int x,y;
    pt():x(0),y(0){}
    void read(){
        scanf("%d%d",&x,&y);
    }
    bool operator <(const pt &a){
        return x==a.x?y<a.y:x<a.x;
    }
}p[maxn];
vector<int> ss;
int ans,n;

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        p[i].read();
        ss.push_back(p[i].x);
        ss.push_back(p[i].y);
    }
    ss.push_back((int)(-1e9-7));
    sort(ss.begin(),ss.end());
    ss.erase(unique(ss.begin(),ss.end()),ss.end());
    for(int i=1;i<=n;i++){
        p[i].x=(int)(lower_bound(ss.begin(),ss.end(),p[i].x)-ss.begin());
        p[i].y=(int)(lower_bound(ss.begin(),ss.end(),p[i].y)-ss.begin());
    }
    ///how many rectangle contain each point
    ///obviously there is at least 2^(n-1) subsets containing such point
    ///exclude this shit from all others set now
    ///there is 2^(n-1)-1 subsets left
    ///we are going to subtract nonempty subset from this that doesn't contain
    sort(p+1,p+1+n);
    int cur=0;
   // for(int i=1;i<=n;i++)
     //   cerr<<p[i].x<<' '<<p[i].y<<'\n';
    BIT f1((int)ss.size()),f2((int)ss.size());
    for(int i=1;i<=n;i++)
        f1.update(p[i].y,1);
    for(int i=1;i<=n;i++){
        int j=i,ct=0;
        while(p[j].x==p[i].x&&j<=n){
            f1.update(p[j].y,-1);
            ct++;
            j++;
        }
        j--;
     //   cerr<<i<<": \n";
        for(int k=i;k<=j;k++){
        plusle(ans,sub(power(2,n),1));
        ///completely above
        cur = f1.get(p[k].y+1,(int)ss.size()) + f2.get(p[k].y+1,(int)ss.size()) + (j-k);
        /// 0
        minun(ans,sub(power(2,cur),1));
        ///completely below
        cur = f1.get(p[k].y-1)+ f2.get(p[k].y-1) + (k-i);
        minun(ans,sub(power(2,cur),1));
        ///3
        ///completely left
        minun(ans,sub(power(2,i-1),1));
        ///0 4
        ///completely right
        minun(ans,sub(power(2,n-j),1));
        /// 1
        ///shitty four corners
        ///left-up
        cur = f2.get(p[k].y+1,(int)ss.size());
       // cerr<<cur<<'\n';
        plusle (ans,sub(power(2,cur),1));
        ///left down
        cur=f2.get(p[k].y-1);
       // cerr<<cur<<'\n';
        plusle(ans,sub(power(2,cur),1));
        ///right up
        cur=f1.get(p[k].y+1,(int)ss.size());
     //   cerr<<cur<<'\n';
        plusle(ans,sub(power(2,cur),1));
        ///right down
       // cerr<<cur<<'\n';
        cur=f1.get(p[k].y-1);
        plusle(ans,sub(power(2,cur),1));
     /*
        plusle(ans,sub(power(2,i-1),1));
        plusle(ans,sub(power(2,n-j),1));
        int cur=f2.get(p[k].y+1,(int)ss.size());
        minun(ans,sub(power(2,cur),1));
        cur=(f2.get(p[k].y-1));
        minun(ans,sub(power(2,cur),1));
        cur=(f1.get(p[k].y+1,(int)ss.size()));
        minun(ans,sub(power(2,cur),1));
        cur=(f1.get(p[k].y-1));
        minun(ans,sub(power(2,cur),1));
        cur=(f1.get(p[k].y+1,(int)ss.size())+f2.get(p[k].y+1,(int)ss.size()))+(j-k);
        plusle(ans,sub(power(2,cur),1));
        cur=(f1.get(p[k].y-1)+f2.get(p[k].y-1))+(k-i);
        plusle(ans,sub(power(2,cur),1));
        */


        }
        for(int k=i;k<=j;k++){
            f2.update(p[k].y,1);
        }
        i=j;
    }
    printf("%d\n",ans);
}

/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 8176