#include<bits/stdc++.h>

using namespace std;

const int NP = (int)2e5 + 5, mod = 998244353;
int nP, pow2[NP], ans;
vector<int> xComp, yComp;

struct Point {
    int x, y;
    Point(int _x = 0, int _y = 0) : x(_x), y(_y) {}
} p[NP];

struct Bit2D {
    vector<int> a[NP], ySet[NP];
    void addY(int x, int y) {
        assert(x > 0 && x < NP && y > 0 && y < NP);
        for (int _x = x; _x < NP; _x += _x & -_x) ySet[_x].push_back(y);
    }
    void prep() {
        for (int x = 1; x < NP; ++x) {
            ySet[x].push_back(0);
            sort(ySet[x].begin(), ySet[x].end() );
            ySet[x].erase(unique(ySet[x].begin(), ySet[x].end() ), ySet[x].end() );
            a[x].assign( (int)ySet[x].size(), 0);
        }
    }
    void upd(int x, int y, int value) {
        assert(x > 0 && x < NP && y > 0 && y < NP);
        for (int _x = x; _x < NP; _x += _x & -_x) {
            int _y = (int)(lower_bound(ySet[_x].begin(), ySet[_x].end(), y) - ySet[_x].begin() );
            for (; _y < (int)a[_x].size(); _y += _y & -_y) a[_x][_y] += value;
        }
    }
    int get(int x, int y) {
        assert(x >= 0 && x < NP && y >= 0 && y < NP);
        int ret = 0;
        for (int _x = x; _x > 0; _x -= _x & -_x) {
            int _y = (int)(upper_bound(ySet[_x].begin(), ySet[_x].end(), y) - ySet[_x].begin() ) - 1;
            for (; _y > 0; _y -= _y & -_y) ret += a[_x][_y];
        }
        return ret;
    }
} bit2D;

int add(int _a, int _b) {
    _a += _b;
    if (_a >= mod) _a -= mod;
    return _a;
}
int sub(int _a, int _b) { return add(_a, mod - _b); }

int noRect(int sz) { return sub(pow2[sz], 1); }

int getSz(int lX, int lY, int rX, int rY) {
    return sub(add(bit2D.get(rX, rY), bit2D.get(lX - 1, lY - 1) ), add(bit2D.get(rX, lY - 1), bit2D.get(lX - 1, rY) ) );
}

int calc(Point point) {
    int ret = noRect(nP);

    ret = sub(ret, noRect(getSz(1, 1, point.x - 1, NP - 1) ) );
    ret = sub(ret, noRect(getSz(1, 1, NP - 1, point.y - 1) ) );
    ret = sub(ret, noRect(getSz(point.x + 1, 1, NP - 1, NP - 1) ) );
    ret = sub(ret, noRect(getSz(1, point.y + 1, NP - 1, NP - 1) ) );

    ret = add(ret, noRect(getSz(1, 1, point.x - 1, point.y - 1) ) );
    ret = add(ret, noRect(getSz(1, point.y + 1, point.x - 1, NP - 1) ) );
    ret = add(ret, noRect(getSz(point.x + 1, 1, NP - 1, point.y - 1) ) );
    ret = add(ret, noRect(getSz(point.x + 1, point.y + 1, NP - 1, NP - 1) ) );

    return ret;
}

int main() {
    pow2[0] = 1; for (int i = 1; i < NP; ++i) pow2[i] = 2 * pow2[i - 1] % mod;

    scanf("%d", &nP);
    xComp.assign(nP, 0);
    yComp.assign(nP, 0);
    for (int i = 1; i <= nP; ++i) {
        scanf("%d %d", &p[i].x, &p[i].y);
        xComp[i - 1] = p[i].x;
        yComp[i - 1] = p[i].y;
    }
    sort(xComp.begin(), xComp.end() );
    sort(yComp.begin(), yComp.end() );
    for (int i = 1; i <= nP; ++i) {
        p[i].x = (int)(lower_bound(xComp.begin(), xComp.end(), p[i].x) - xComp.begin() ) + 1;
        p[i].y = (int)(lower_bound(yComp.begin(), yComp.end(), p[i].y) - yComp.begin() ) + 1;
        bit2D.addY(p[i].x, p[i].y);
    }

    bit2D.prep();
    for (int i = 1; i <= nP; ++i) bit2D.upd(p[i].x, p[i].y, 1);

    for (int i = 1; i <= nP; ++i) ans = add(ans, calc(p[i]) );

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 41332