#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 998244353
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

class BIT{
private:
    //[1,n]
    vector<int> bit;
    int n;

public:
    BIT(){}
    BIT(int size){
        n = size;
        bit = vector<int>(n+1,0);
    }
    //[0,i)のsum（内部実装は[1,i]）
    int sum(int i){
        int s = 0;
        while(i > 0){
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, int x){
        while(i <= n){
            bit[i] += x;
            i += i & -i;
        }
    }
    void show(){
        for(int i = 1; i <= n; i++){
            cout << " " << bit[i];
        }
        cout << endl;
    }
};

int beki[200005];

int g(int a, int b, int c, int d){
    int ret = 1;
    ret *= a;
    ret %= MOD;
    ret *= b;
    ret %= MOD;
    ret *= c;
    ret %= MOD;
    ret *= d;
    ret %= MOD;
    return ret;
}

int f(int a, int b, int c, int d){
    vi num(4);
    num[0] = a;
    num[1] = b;
    num[2] = c;
    num[3] = d;
    vi o(4),ox(4);
    rep(i,4){
        ox[i] = beki[num[i]];
        o[i] = (ox[i] - 1 + MOD) % MOD;
    }
    int ret = 0;
    ret += g(ox[0],o[1],o[2],ox[3]);
    ret %= MOD;
    ret += g(o[0],ox[1],ox[2],o[3]);
    ret %= MOD;
    ret -= g(o[0],o[1],o[2],o[3]);
    ret %= MOD;
    ret += g(ox[0],ox[1],ox[2],ox[3]);
    ret %= MOD;
    return ret;
}

signed main(void) {
    int n;
    cin >> n;
    vp v(n);
    rep(i,n)cin >> v[i].first >> v[i].second;
    {
        map<int,int> ma;
        rep(i,n)ma[v[i].first] = 1;
        int j = 0;
        for(auto &x:ma)x.second = j++;
        rep(i,n)v[i].first = ma[v[i].first];
    }
    {
        map<int,int> ma;
        rep(i,n)ma[v[i].second] = 0;
        int j = 0;
        for(auto &x:ma)x.second = j++;
        rep(i,n)v[i].second = ma[v[i].second];
    }
    sort(all(v));
    vi a(n,0),b(n,0),c(n,0),d(n,0);
    rep(_,2){
        BIT bit(n);
        rep(i,n){
            a[i] = bit.sum(v[i].second+1);
            b[i] = i - a[i];
            bit.add(v[i].second+1, 1);
        }
        reverse(all(v));
        swap(a,c);
        swap(b,d);
        reverse(all(a));
        reverse(all(b));
        reverse(all(c));
        reverse(all(d));
    }
    int ans = 0;
    beki[0] = 1;
    rep(i,n)beki[i+1] = beki[i]*2 % MOD;

    rep(i,n){
        ans += f(a[i],b[i],c[i],d[i]);
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 17920