#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 998244353;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll modadd(ll x, ll y) {
    return ((x + y) % mod + mod) % mod;
}

ll modminus(ll x, ll y) {
    return (x - y + mod) % mod;
}

ll multiply(ll x, ll y) {
    return (x % mod) * (y % mod) % mod;
}

ll modpower(ll x, ll y) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else if (y % 2 == 0) {
        ll p = modpower(x, y / 2);
        return p * p % mod;
    } else {
        ll p = modpower (x, y / 2);
        return (p * p) % mod * (x % mod) % mod;
    }
}

ll two[200010];

//RAQ and RUQ
template<typename T>
struct segtree {
    T L0 = 0;
    T L1 = inf;
    T INF = 0;
    int n;
    vector<T> lazy, dat, lazyupdate;
 
    void init(int n_) {
        n = 1;
        while (n < n_) {
            n *= 2;
        }
        lazy.assign(2 * n - 1, L0);
        lazyupdate.assign(2 * n - 1, inf);
        dat.assign(2 * n - 1, INF);
    }

    void push(ll len, int k) {
        if (lazyupdate[k] != L1) {
            dat[k] = lazyupdate[k] * len;
            if (k < n - 1) {
                lazyupdate[k * 2 + 1] = lazyupdate[k];
                lazyupdate[k * 2 + 2] = lazyupdate[k];
            }
            lazyupdate[k] = L1;
        } else {
            if (lazy[k] == L0) {
                return;
            }
            dat[k] += lazy[k] * len;
            if (k < n - 1) {
                if (lazyupdate[k * 2 + 1] != L1) {
                    lazyupdate[k * 2 + 1] += lazy[k];
                } else {
                    lazy[k * 2 + 1] += lazy[k];
                }
                if (lazyupdate[k * 2 + 2] != L1) {
                    lazyupdate[k * 2 + 2] += lazy[k];
                } else {
                    lazy[k * 2 + 2] += lazy[k];
                }
            }
        }
        lazy[k] = L0;
    }
    
    void baseadd(int a, int b, T x, int k, int l, int r) {
        push(r - l, k);
        if (a <= l && r <= b) {
            lazy[k] += x;
            push(r - l, k);
        } else if (l < b && a < r) {
            baseadd(a, b, x, k * 2 + 1, l, (l + r) / 2);
            baseadd(a, b, x, k * 2 + 2, (l + r) / 2, r);
            dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
        }
    }

    void addquery(int a, int b, T x) {
        baseadd(a, b, x, 0, 0, n);
    }

    void baseupdate(int a, int b, T x, int k, int l, int r) {
        push(r - l, k);
        if (a <= l && r <= b) {
            lazyupdate[k] = x;
            push(r - l, k);
        } else if (l < b && a < r) {
            baseupdate(a, b, x, k * 2 + 1, l, (l + r) / 2);
            baseupdate(a, b, x, k * 2 + 2, (l + r) / 2, r);
            dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
        }
    }

    void updatequery(int a, int b, T x) {
        baseupdate(a, b, x, 0, 0, n);
    }
 
    T basequery(int a, int b, int k, int l, int r) {
        push(r - l, k);
        if (r <= a || b <= l) {
            return INF;
        }
        if (a <= l && r <= b) {
            return dat[k];
        } else {
            T vl = basequery(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = basequery(a, b, k * 2 + 2, (l + r) / 2, r);
            // dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
            return vl + vr;
        }
    }

    //[l, r)の範囲の合計を返す
    T query(int l, int r) {
        return basequery(l, r, 0, 0, n);
    }

    //k番目にaを代入する
    void update(int k, T a) {
        T base = query(k, k + 1);
        addquery(k, k + 1, a - base);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    plglg pt[N];
    ll ys[N];
    REP(i, 0, N) {
        ll x, y;
        cin >> x >> y;
        pt[i] = plglg(x, y);
        ys[i] = y;
    }
    two[0] = 1;
    REP(i, 0, N) {
        two[i + 1] = multiply(two[i], 2);
    }
    REP(i, 0, N + 1) {
        two[i] = modminus(two[i], 1);
    }
    sort(pt, pt + N);
    sort(ys, ys + N);
    map<ll, ll> mp;
    REP(i, 0, N) {
        mp[ys[i]] = i;
    }
    segtree<ll> seg;
    seg.init(N);
    ll sum = 0;
    REP(i, 0, N) {
        plglg p = pt[i];
        ll lf = i;
        ll rt = (N - 1 - i);
        ll bot = lower_bound(ys, ys + N, p.second) - ys;
        ll top = N - 1 - bot;
        ll lfbot = seg.query(0, mp[p.second]);
        seg.update(mp[p.second], 1);
        // cout << lfbot << endl;
        ll rtbot = bot - lfbot;
        ll lftop = lf - lfbot;
        ll rttop = rt - rtbot;
        // cout << lf << " "  << rt << " " << bot << " " << top << endl;
        // cout << lfbot << " " << rtbot << " " << lftop << " " << rttop << endl;
        // cout << "aaa" << endl;
        ll tmp = modadd(two[lf], two[rt]);
        tmp = modadd(tmp, modadd(two[top], two[bot]));
        tmp = modminus(tmp, modadd(two[lfbot], two[lftop]));
        tmp = modminus(tmp, modadd(two[rtbot], two[rttop]));
        sum = modadd(sum, tmp);
        // cout << tmp << endl;
        // if (i % 1000 == 0) {
        //     cout << "aaa" << i << endl;
        // }
    }
    ll ans = modminus(multiply(modminus(modpower(2, N), 1), N), sum);
    cout << ans << endl;
}


Measured memory_bytes: 31360