#include <iostream>
#include <math.h>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstdlib>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 998244353;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}


#define MAX_N 210000

class BIT {
public:
    ll bit[MAX_N + 1];

    void init(int n) {
        for (int i = 0; i < n; i++) {
            bit[i] = 0;
        }
    }

    // indexが0~iまでの和を求める。
    ll sum(int i) {
        ll s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & (-i);
        }
        return s;
    }

    // iがindex, xが加える値, nが全体の配列の大きさ
    void add(int i, ll x, int n) {
        i++;
        while (i <= n) {
            bit[i] += x;
            i += i & (-i);
        }
    }
};

unordered_map<ll, ll> zip;  //圧縮前の座標、圧縮後の座標

int compress(vector<ll> &x){
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(),x.end()),x.end());
    for(int i = 0; i < x.size(); i++){
        zip[x[i]] = i;
    }
    return (int)x.size();
}

ll pow2[210000];

int main() {
    pow2[0] = 1;
    for(int i = 1; i < 210000; i++){
        pow2[i] = mul(pow2[i-1], 2);
    }

    int N;
    vector<ll> x, y;
    unordered_map<ll, ll> x2y;

    cin >> N;
    for(int i = 0; i < N; i++){
        ll xt, yt;
        cin >> xt >> yt;

        x.push_back(xt);
        y.push_back(yt);
        x2y[xt] = yt;
    }

    sort(x.begin(), x.end());
    compress(y);

    BIT bit1, bit2;

    bit1.init(N);
    bit2.init(N);

    for(int i = N-1; i >= 0; i--){
        bit2.add(zip[x2y[x[i]]], 1, N);
    }

    ll res = 0;
    for(int i = 0; i < N; i++){
        bit2.add(zip[x2y[x[i]]], -1, N);
        ll below1 = bit1.sum(zip[x2y[x[i]]]);
        ll below2 = bit2.sum(zip[x2y[x[i]]]);
        ll upper1 = i - below1;
        ll upper2 = (N-i-1) - below2;

        // x[i]を含む
        ll v = pow2[N-1];

        // x[i]を含まない
        // 左上と右下が存在
        v = add(v, mul(mul(pow2[upper1]-1, pow2[below2]-1), pow2[upper2 + below1]));

        // 右上と左下が存在、右下のみ存在
        v = add(v, mul(mul(pow2[upper2]-1, pow2[below1]-1), pow2[below2]-1));

        // 右上と左下が存在、左上のみ存在
        v = add(v, mul(mul(pow2[upper2]-1, pow2[below1]-1), pow2[upper1]-1));

        // 右上と左下が存在、右下も左下も存在しない
        v = add(v, mul(pow2[upper2]-1, pow2[below1]-1));

//        cout << v << endl;
        res = add(res, v);
        bit1.add(zip[x2y[x[i]]], 1, N);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 26828