#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

// 区間加算区間和
struct RSQRAQ {
    ll n;
    vector<ll> dat, lazy;
    RSQRAQ(){}
    RSQRAQ(ll n_) {
        n = 1; while(n < n_) n *= 2;
        dat.assign(n*2, 0);
        lazy.assign(n*2, 0);
    }
    void eval(ll len, ll k) {
        if(lazy[k] == 0) return;
        if(k*2+1 < n*2-1) {
            lazy[2*k+1] += lazy[k];
            lazy[2*k+2] += lazy[k];
        }
        dat[k] += lazy[k]*len;
        lazy[k] = 0;
    }
    // [a, b)にxを加える
    ll update(ll a, ll b, ll x, ll k, ll l, ll r) {
        eval(r-l, k);
        if(b <= l || r <= a) return dat[k];
        if(a <= l && r <= b) {
            lazy[k] += x;
            return dat[k] + lazy[k]*(r-l);
        }
        return dat[k] = update(a, b, x, 2*k+1, l, (l+r)/2) + update(a, b, x, 2*k+2, (l+r)/2, r);
    }
    ll update(ll a, ll b, ll x) { return update(a, b, x, 0, 0, n); }
    // [a, b)の和を求める
    ll query(ll a, ll b, ll k, ll l, ll r) {
        eval(r-l, k);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return dat[k];
        ll vl = query(a, b, 2*k+1, l, (l+r)/2);
        ll vr = query(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
    ll query(ll a, ll b) { return query(a, b, 0, 0, n); }
};
//セグ木なので番号は0~n-1
/////////////////////////////////////////
ll po(ll i,ll p){
    if(p==0)return 1;
    else if(p==1)return mod(i);
    else if(p%2==0)return po(mod(mod(i)*mod(i)),p/2);
    else return mod(mod(i)*po(i,p-1));
}
ll n;
ll cal(ll a,ll b){
    ll c=n-a-b;
    ll ret=po(2,a)-1;
    ret=mod(ret*(po(2,b)-1));
    ret=mod(ret*po(2,c-1));
    return ret;
}
ll cal2(ll a,ll b,ll c,ll d){
    ll ret=0;
    a=po(2,a)-1;
    b=po(2,b)-1;
    c=po(2,c)-1;
    d=po(2,d)-1;
    ret=mod(mod(a*b)*mod(c*d));
    return ret;
}
int main(){
    cin>>n;
    ll x[n],y[n];rep(i,0,n-1)cin>>x[i]>>y[i];
    vector<ll>cx,cy;
    rep(i,0,n-1){
        cx.pb(x[i]);cy.pb(y[i]);
    }
    sort(cx.begin(),cx.end());sort(cy.begin(),cy.end());
    cx.erase(unique(cx.begin(),cx.end()),cx.end());cy.erase(unique(cy.begin(),cy.end()),cy.end());
    rep(i,0,n-1){
        x[i]=lower_bound(cx.begin(),cx.end(),x[i])-cx.begin();
        y[i]=lower_bound(cy.begin(),cy.end(),y[i])-cy.begin();
    }
    l_l p[n];
    rep(i,0,n-1)p[i]=l_l(x[i],y[i]);
    sort(p,p+n);
    ll cou[n][4];memset(cou,0,sizeof(cou));
    /*rep(i,0,n-1){
        cout<<p[i].first<<" "<<p[i].second<<endl;
    }*/
    
    RSQRAQ u(n);
    rep(i,0,n-1){
        cou[i][0]=u.query(0,p[i].second);
        cou[i][1]=u.query(p[i].second+1,n);
        u.update(p[i].second,p[i].second+1,1);
    }
    RSQRAQ w(n);
    for(ll i=n-1;i>=0;i--){
        cou[i][2]=w.query(0,p[i].second);
        cou[i][3]=w.query(p[i].second+1,n);
        w.update(p[i].second,p[i].second+1,1);
    }
    /*rep(i,0,n-1){
        rep(j,0,3){
            cout<<cou[i][j]<<" ";
            if(j==1)cout<<" ";
        }cout<<endl;
    }cout<<endl;*/
    ll ans=mod(n*po(2,n-1));
    rep(i,0,n-1){
        ll c=0;
        Add(c,cal(cou[i][0],cou[i][3]));
        Add(c,cal(cou[i][2],cou[i][1]));
        Add(c,-cal2(cou[i][0],cou[i][3],cou[i][1],cou[i][2]));
        Add(ans,c);
    }

    cout<<mod(ans)<<endl;
    return 0;
}

















Measured memory_bytes: 33508