#include <bits/stdc++.h>

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

// FenwickTree (0 - indexed)
// T: 可換モノイド
template<typename T>
class FenwickTree {
    const int n;
    const T ZERO;
    std::vector<T> data;
public:
    // 要素数を指定し、全要素0で初期化
    FenwickTree(int n, T ZERO) : n(n), ZERO(ZERO), data(n + 1, ZERO) {}

    // 元となるstd::vectorを用意して初期化
    FenwickTree(std::vector<T> source, T ZERO) : n(source.size()), ZERO(ZERO), data(n + 1) {
        std::copy(source.begin(), source.end(), data.begin() + 1);
        for (int i = 1; i < n; i++) data[i + (i & -i)] += data[i];
    }

    // [0, i)の区間和を取得
    T getSum(int i) const {
        T ret = ZERO;
        for (i; i > 0; i -= i & -i)ret += data[i];
        return ret;
    }

    // 要素iにxを加算
    void add(int i, T x) { for (i++; i <= n; i += i & -i)data[i] += x; }

    // 以下、T: 可換群

    // [l, r)の区間和を取得
    T getSum(int l, int r) const {
        return getSum(r) - getSum(l);
    }

    // [0, i)の区間和がx以上となる最小のiを取得 (区間和の単調性が必要)
    int getLowerBound(T x) const {
        if (x <= ZERO) return 0;
        int i = 0, r = 1;
        while (r < n) r <<= 1;
        for (int k = r; k > 0; k >>= 1) {
            if (i + k <= n && data[i + k] < x) {
                x -= data[i + k];
                i += k;
            }
        }
        return i + 1;
    }
};

// 二次元FenwickTree (0 - indexed)
// T: 可換モノイド
template<typename T>
class TwoDimFenwickTree {
    const int n, m;
    const T ZERO;
    std::vector<std::vector<T>> data;
public:
    // 要素数を指定し、全要素0で初期化
    TwoDimFenwickTree(int n, int m, T ZERO) : n(n), m(m), ZERO(ZERO), data(n + 1, std::vector<T>(m + 1, ZERO)) {}

    // [(0, 0), (i, j))の矩形和を取得
    T getSum(int i, int j) const {
        T ret = 0;
        for (; i > 0; i -= i & -i)for (int j2 = j; j2 > 0; j2 -= j2 & -j2)ret += data[i][j2];
        return ret;
    }

    // 要素(i, j)にxを加算
    void add(int i, int j, T x) {
        for (i++; i <= n; i += i & -i)for (int j2 = j + 1; j2 <= m; j2 += j2 & -j2)data[i][j2] += x;
    }

    // 以下、T: 可換群

    // [(y1, x1), (y2, x2))の矩形和を取得
    T getSum(int y1, int x1, int y2, int x2) const {
        return getSum(y2, x2) - getSum(y2, x1) - getSum(y1, x2) + getSum(y1, x1);
    }
};

int N;
int x[220000], y[220000];
pint point[220000];
int tw[220000];
int mod = 998244353;

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
        point[i] = pint(x[i], y[i]);
    }
    sort(point, point + N);
    for (int i = 0; i < N; i++)point[i].first = i;
    for (int i = 0; i < N; i++)swap(point[i].first, point[i].second);
    sort(point, point + N);
    FenwickTree<int> l(N, 0), r(N, 0);
    for (int i = 0; i < N; i++)r.add(i, 1);
    int ans = 0;
    tw[0] = 1;
    for (int i = 1; i <= N; i++)tw[i] = tw[i - 1] * 2 % mod;
    for (int i = 0; i < N; i++) {
        r.add(point[i].second, -1);
        int A = l.getSum(point[i].second);
        int B = l.getSum(point[i].second, N);
        int C = r.getSum(point[i].second);
        int D = r.getSum(point[i].second, N);
        (ans += tw[N] - 1 + mod) %= mod;
        (ans -= tw[A + B] - mod) %= mod;
        (ans -= tw[A + C] - mod) %= mod;
        (ans -= tw[B + D] - mod) %= mod;
        (ans -= tw[C + D] - mod) %= mod;
        (ans += tw[A]) %= mod;
        (ans += tw[B]) %= mod;
        (ans += tw[C]) %= mod;
        (ans += tw[D]) %= mod;
        l.add(point[i].second, 1);
    }
    cout << ans << endl;

}

Measured memory_bytes: 11648