/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    ll a;
    const ll MOD=998244353;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
vector<modint> pp(200010);
modint p2(int n,bool f=1){
    if(f) return p2(n,0)-1;
    if(pp[n]!=0) return pp[n];
    if(n==0) return pp[0]=1;
    return pp[n]=p2(n-1,0)*2;
}

template<class T> void cc(vector<T> a,map<T,int>& nm,vector<int>& c){
    sort(a.begin(),a.end());
    fr(i,a.size()){
        if(i<a.size()-1&&a[i]==a[i+1]) continue;
        nm[a[i]]=c.size();
        c.emplace_back(a[i]);
    }
}

struct BIT{
    vector<ll> bt;
    ll n,m;
    BIT(ll n_){
        n=n_;m=1;
        while(m<=n_) m*=2;
        m/=2;
        bt.resize(n+1);
    }
    ll sum(ll i){
        if(!i) return 0;
        return bt[i]+sum(i-(i&-i));
    }
    ll ad(ll i,ll x,bool f=1){
        if(f) return ad(i+1,x,0);
        if(i>n) return i;
        bt[i]+=x;
        ad(i+(i&-i),x,0);
        return i;
    }
    ll lb(ll k){
        ll x=0;
        for(int i=m;i>0;i/=2){
            if(x+i<=n&&bt[x+i]<k) {
                k-=bt[x + i];
                x+=i;
            }
        }
        return x+1;
    }
};

bool o1(pair<int,int> a,pair<int,int> b){
    if(a.first<b.first) return 1;
    if(a.second>b.second) return 1;
    return 0;
}

class FEnclosedPoints {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n;
        in>>n;
        vector<int> x(n),y(n),cx,cy;
        vector<int> ax,ay;
        map<int,int> nmx,nmy;
        fr(i,n) in>>x[i]>>y[i],ax.emplace_back(x[i]),ay.emplace_back(y[i]);
        cc(ax,nmx,cx);
        cc(ay,nmy,cy);
        vector<int> vx(cx.size()),vy(cy.size()),sx(cx.size()+1),sy(cy.size()+1);
        vector<pair<int,int>> xy(n);
        fr(i,n){
            ++vx[x[i]=nmx[x[i]]];
            ++vy[y[i]=nmy[y[i]]];
            xy[i]=make_pair(x[i],y[i]);
        }
        fr(i,cx.size()) sx[i+1]=sx[i]+vx[i];
        fr(i,cy.size()) sy[i+1]=sy[i]+vy[i];
        int X=sx[cx.size()],Y=sy[cy.size()];
        modint ans,k=p2(n);
        fr(i,n){
            ans+=k-p2(sx[x[i]])-p2(sy[y[i]])-p2(X-sx[x[i]+1])-p2(Y-sy[y[i]+1]);
        }
        sort(xy.begin(),xy.end());
        BIT b1(cy.size());
        fr(i,n){
            b1.ad(xy[i].second,1);
            ans+=p2(b1.sum(xy[i].second))+p2(i+1-b1.sum(xy[i].second+1));
        }
        reverse(xy.begin(),xy.end());
        BIT b2(cy.size());
        fr(i,n){
            b2.ad(xy[i].second,1);
            ans+=p2(b2.sum(xy[i].second))+p2(i+1-b2.sum(xy[i].second+1));
        }
        out<<ans<<endl;
    }
};

int main() {
    FEnclosedPoints solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 37728