#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

template <typename T>
struct hash_map_t {
    vector <T> v, val, nxt;
    vector <int> head;
    int mod, tot, lastv;
    T lastans;
    bool have_ans;

    hash_map_t (int md = 0) {
        head.clear(); v.clear(); val.clear(); nxt.clear(); tot = 0; mod = md;
        nxt.resize(1); v.resize(1); val.resize(1); head.resize(mod);
        have_ans = 0;
    }

    void clear() { *this = hash_map_t(mod); }

    bool count(int x) {
        int u = x % mod;
        for(register int i = head[u]; i; i = nxt[i]) {
            if(v[i] == x) {
                have_ans = 1;
                lastv = x;
                lastans = val[i];
                return 1;
            }
        }
        return 0;
    }

    void ins(int x, int y) {
        int u = x % mod;
        nxt.push_back(head[u]); head[u] = ++tot;
        v.push_back(x); val.push_back(y);
    }

    int qry(int x) {
        if(have_ans && lastv == x) return lastans;
        count(x);
        return lastans;
    }
};

const int N = 2e5 + 5, md = 998244353;

inline int add(int x, int y) {
    x += y;
    if(x >= md) x -= md;
    return x;
}

inline int sub(int x, int y) {
    x -= y;
    if(x < 0) x += md;
    return x;
}

inline int mul(int x, int y) { return 1ll * x * y % md; }

inline int fpow(int x, int y) {
    int ans = 1;
    while(y) {
        if(y & 1) ans = mul(ans, x);
        y >>= 1; x = mul(x, x);
    }
    return ans;
}

struct ele { int x, y, id; } a[N];

int x[N], y[N], tmpx[N], tmpy[N], f[N], v[5][N];
int n, ans;

inline int lowbit(int x) { return x & -x; }

void add(int x) {
    for(register int i = x; i <= n; i += lowbit(i))
        ++f[i];
}

int query(int x) {
    int ans = 0;
    for(register int i = x; i; i ^= lowbit(i))
        ans += f[i];
    return ans;
}

bool cmp(ele a, ele b) { return a.x < b.x; }

int main() {
    read(n);
    for(register int i = 1; i <= n; i++) read(x[i]), read(y[i]), tmpx[i] = x[i], tmpy[i] = y[i];
    sort(tmpx + 1, tmpx + n + 1); sort(tmpy + 1, tmpy + n + 1);
    for(register int i = 1; i <= n; i++) {
        x[i] = lower_bound(tmpx + 1, tmpx + n + 1, x[i]) - tmpx;
        y[i] = lower_bound(tmpy + 1, tmpy + n + 1, y[i]) - tmpy;
        a[i] = (ele) {x[i], y[i], i};
    }
    sort(a + 1, a + n + 1, cmp);
    for(register int i = 1; i <= n; i++) {
        int val = query(a[i].y);
        v[1][a[i].id] = val; v[2][a[i].id] = i - 1 - val;
        add(a[i].y);
    }
    memset(f, 0, sizeof(f));
    for(register int i = n; i >= 1; i--) {
        int val = query(a[i].y);
        v[4][a[i].id] = val; v[3][a[i].id] = n - i - val;
        add(a[i].y);
    }
    for(register int i = 1; i <= n; i++) {
        ans = add(ans, fpow(2, n));
        for(register int j = 1; j <= 4; j++) {
            int go = j + 1;
            if(go == 5) go = 1;
            ans = sub(ans, fpow(2, v[j][i] + v[go][i]));
            ans = add(ans, fpow(2, v[j][i]));
        }
    }
    ans = sub(ans, n);
    print(ans, '\n');
    return 0;
}

Measured memory_bytes: 9600