// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 998244353LL;

ll mod_pow(ll n, ll k) {
    ll res = 1;
    for(; k>0; k>>=1) {
        if(k & 1) (res *= n) %= MOD;
        (n *= n) %= MOD;
    }
    return res;
}

// 抽象 SegmentTree (0-indexed・一点更新・区間取得)
template <typename MonoidType>
struct SegmentTree {
    using Function = function< MonoidType(MonoidType, MonoidType) >;

    // node, identity element
    int n;
    vector<MonoidType> node;
    MonoidType E0;

    // update / combine function
    Function upd_f, cmb_f;

    void build(int m, vector<MonoidType> v = vector<MonoidType>()) {
        if(v != vector<MonoidType>()) m = v.size();
        n = 1; while(n < m) n *= 2;

        node = vector<MonoidType>(2*n-1, E0);
        if(v != vector<MonoidType>()) {
            for(int i=0; i<m; i++) {
                node[n-1+i] = v[i];
            }
            for(int i=n-2; i>=0; i--) {
                node[i] = cmb_f(node[2*i+1], node[2*i+2]);
            }
        }
    }

    // initialize
    SegmentTree() {}
    SegmentTree(int n_, MonoidType E0_,
                Function upd_f_, Function cmb_f_,
                vector<MonoidType> v = vector<MonoidType>()) :
        E0(E0_), upd_f(upd_f_), cmb_f(cmb_f_) {
        build(n_, v);
    }

    // update k-th element (applied value: x)
    void update(int k, MonoidType x) {
        k += n - 1;
        node[k] = upd_f(node[k], x);
        while(k > 0) {
            k = (k - 1) / 2;
            node[k] = cmb_f(node[2*k+1], node[2*k+2]);
        }
    }

    // range query for [a, b)
    // 非再帰のアイデア: http://d.hatena.ne.jp/komiyam/20131202/1385992406
    MonoidType query(int a, int b) {
        MonoidType vl = E0, vr = E0;
        for(int l=a+n, r=b+n; l<r; l>>=1, r>>=1) {
            if(l & 1) vl = cmb_f(vl, node[(l++)-1]);
            if(r & 1) vr = cmb_f(node[(--r)-1], vr);
        }
        return cmb_f(vl, vr);
    }
};
 
int main() {
    using Pair = pair<ll, ll>;
    using Tuple = tuple<ll, ll, ll>;
    
    int N; scanf("%d", &N);
    vector< Tuple > points(N);
    for(int i=0; i<N; i++) {
        int x, y; scanf("%d%d", &x, &y);
        points[i] = make_tuple(x, y, i);
    }

    // x 座標の座圧
    int M = 0;
    map<ll, ll> cmpx;
    for(auto p : points) cmpx[ get<0>(p) ]++;
    for(auto &e : cmpx) e.second = M++;


    vector<ll> lu(N), rd(N), ld(N), ru(N);
    sort(points.begin(), points.end(), [&](Tuple a, Tuple b) {
            ll ax, ay, az; tie(ax, ay, az) = a;
            ll bx, by, bz; tie(bx, by, bz) = b;
            
            // y の小さい順 -> x の大きい順
            if(ay != by) return ay < by;
            return ax > bx;
        });

    auto f = [](ll a, ll b) { return a + b; };
    ll E = 0;

    {        
        SegmentTree<ll> seg(M, E, f, f);
        
        for(int i=0; i<N; i++) {
            ll x, y, k; tie(x, y, k) = points[i];

            // x 座標が自分以上のもの
            rd[k] = seg.query(cmpx[x], M);
            seg.update(cmpx[x], 1);
        }
    }

    sort(points.begin(), points.end(), [&](Tuple a, Tuple b) {
            ll ax, ay, az; tie(ax, ay, az) = a;
            ll bx, by, bz; tie(bx, by, bz) = b;
            
            // y の大きい順 -> x の小さい順
            if(ay != by) return ay > by;
            return ax < bx;
        });    
    {
        SegmentTree<ll> seg(M, E, f, f);
        
        for(int i=0; i<N; i++) {
            ll x, y, k; tie(x, y, k) = points[i];

            // x 座標が自分以下のもの
            lu[k] = seg.query(0, cmpx[x] + 1);
            seg.update(cmpx[x], 1);
        }
    }

    sort(points.begin(), points.end(), [&](Tuple a, Tuple b) {
            ll ax, ay, az; tie(ax, ay, az) = a;
            ll bx, by, bz; tie(bx, by, bz) = b;
            
            // y の大きい順 -> x の大きい順
            if(ay != by) return ay > by;
            return ax > bx;
        });    
    {
        SegmentTree<ll> seg(M, E, f, f);
        
        for(int i=0; i<N; i++) {
            ll x, y, k; tie(x, y, k) = points[i];

            // x 座標が自分以上のもの
            ru[k] = seg.query(cmpx[x], M);
            seg.update(cmpx[x], 1);
        }
    }

    sort(points.begin(), points.end(), [&](Tuple a, Tuple b) {
            ll ax, ay, az; tie(ax, ay, az) = a;
            ll bx, by, bz; tie(bx, by, bz) = b;
            
            // y の小さい順 -> x の小さい順
            if(ay != by) return ay < by;
            return ax < bx;
        });    
    {
        SegmentTree<ll> seg(M, E, f, f);
        
        for(int i=0; i<N; i++) {
            ll x, y, k; tie(x, y, k) = points[i];

            // x 座標が自分以下のもの
            ld[k] = seg.query(0, cmpx[x] + 1);
            seg.update(cmpx[x], 1);
        }
    }

    ll ans = 0;
    for(int i=0; i<N; i++) {
        // fprintf(stderr, "lu[%d] = %lld, rd[%d] = %lld, ld = %lld, ru = %lld\n", i, lu[i], i, rd[i], ld[i], ru[i]);

        ll sum = 0;
        
        // 自分を含む集合の数 (自分以外の選び方がどうでもよい)
        (sum += mod_pow(2, N-1)) %= MOD;

        ll x = lu[i], y = rd[i], z = ld[i], w = ru[i];
        ll px = (mod_pow(2, x) + MOD - 1) % MOD;
        ll py = (mod_pow(2, y) + MOD - 1) % MOD;
        ll pz = (mod_pow(2, z) + MOD - 1) % MOD;
        ll pw = (mod_pow(2, w) + MOD - 1) % MOD;

        ll sub = 0;
        (sub += px * py) %= MOD;
        (sub += px * py % MOD * pz) %= MOD;
        (sub += px * py % MOD * pw) %= MOD;
        (sub += px * py % MOD * pz % MOD * pw % MOD) %= MOD;

        (sub += pz * pw) %= MOD;
        (sub += pz * pw % MOD * px) %= MOD;
        (sub += pz * pw % MOD * py) %= MOD;
        
        // 自分は含まないが、他の 2 点によって含まれるものの数
        // 少なくとも 1 つの lu かつ少なくとも 1 つの rd
        // 自分以外の N-1 点に着目して、
        // lu だけ含まないもの・rd だけ含まないもの・どちらも含まないもの を引いたほうがいい？？

        (sum += sub) %= MOD;

        (ans += sum) %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 29820