#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define int ll
#define BUF 1e5
#define INF 1 << 30
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
constexpr ll mod = 998244353;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

template <ll mod>
class Fp {
public:
    ll val;

private:
    inline void calc_mod(ll &v) {
        if (v >= mod)
            v -= mod;
    }

public:
    Fp() {}
    Fp(ll v) : val(v % mod) {
        if (val < 0)
            val += mod;
    }
    Fp operator+=(const Fp &in) {
        val += in.val;
        calc_mod(val);
        return *this;
    }
    Fp operator+(const Fp &in) const {
        return Fp(*this) += in;
    }
    Fp &operator-=(const Fp &in) {
        val -= in.val;
        calc_mod(val);
        if (val < 0)
            val += mod;
        return *this;
    }
    Fp operator-(const Fp &in) const {
        return Fp(*this) -= in;
    }
    Fp &operator*=(const Fp &in) {
        val = val * in.val % mod;
        return *this;
    }
    Fp operator*(const Fp &in) const {
        return Fp(*this) *= in;
    }
    Fp &operator/=(const Fp &in) {
        *this *= modpow(in, mod - 2);
        return *this;
    }
    Fp operator/(const Fp &in) const {
        return Fp(*this) /= in;
    }
    bool operator==(const Fp &in) const {
        return val == in.val;
    }
    bool operator!=(const Fp &in) const {
        return val != in.val;
    }
    friend Fp modpow(const Fp &in, ll n) {
        if (n == 0)
            return 1;
        if (n & 1) {
            return in * modpow(in * in, n / 2);
        } else {
            return modpow(in * in, n / 2);
        }
    }
    friend istream &operator>>(istream &is, Fp<mod> &fp) {
        is >> fp.val;
        return is;
    }

    friend ostream &operator<<(ostream &os, Fp<mod> &fp) {
        os << fp.val;
        return os;
    }
};
using modll = Fp<mod>;
class Factorial {
public:
    vector<modll> fact, finv;
    Factorial(ll n) : fact(n + 1, modll(1)), finv(n + 1, modll(1)) {
        for (int i = 2; i <= n; i++) {
            modll tmp(i);
            fact[i] = fact[i - 1] * tmp;
            finv[i] = finv[i - 1] / tmp;
        }
    }
    modll com(const ll &n, const ll &k) {
        if (n < k || n < 0 || k < 0)
            return modll(0);
        return fact[n] * finv[k] * finv[n - k];
    }
};

class SegmentTree {
public:
    vector<int> node;
    int size;
    int n;
    SegmentTree() {}
    SegmentTree(vector<int> in) {
        int in_sz = in.size();
        n = 1;
        while (n < in_sz) {
            n *= 2;
        }
        size = n * 2 - 1;
        node.resize(size, 0);
        for (int i = 0; i < in_sz; i++) {
            node[n - 1 + i] = in[i];
        }
        init_dfs(0);
    }

    int init_dfs(int now) {
        if (2 * now + 1 >= size)
            return node[now];
        node[now] = init_dfs(2 * now + 1) + init_dfs(2 * now + 2);
        return node[now];
    }

    void add(int index, int val) {
        index += n - 1;
        node[index] += val;
        while (index > 0) {
            index = (index - 1) / 2;
            node[index] = node[2 * index + 1] + node[2 * index + 2];
        }
    }

    void update(int index, int val) {
        index += n - 1;
        node[index] = val;
        while (index > 0) {
            index = (index - 1) / 2;
            node[index] = node[2 * index + 1] + node[2 * index + 2];
        }
    }

    int query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    int _query(int a, int b, int now, int l, int r) {
        if (r <= a || b <= l)
            return 0;
        if (a <= l && r <= b)
            return node[now];
        int val_l = _query(a, b, 2 * now + 1, l, (l + r) / 2);
        int val_r = _query(a, b, 2 * now + 2, (l + r) / 2, r);
        return val_l + val_r;
    }
};

signed main() {
    modll ans = 0;
    cin >> N;
    vector<pair<int, int>> xy(N);
    vi x(N), y(N);
    for (int i = 0; i < N; i++) {
        scanf("%ld %ld", &xy[i].first, &xy[i].second);
        x[i] = xy[i].first;
        y[i] = xy[i].second;
    }
    sort(all(x));
    sort(all(y));
    map<int, int> mpx;
    map<int, int> mpy;
    for (int i = 0; i < N; i++) {
        mpx[x[i]] = i;
        mpy[y[i]] = i;
    }
    sort(all(xy));
    SegmentTree stall(vi(N, 0)), stx(vi(N, 0));
    for (int i = 0; i < N; i++) {
        int x = xy[i].first;
        int y = xy[i].second;
        stall.add(mpy[y], 1);
    }
    for (int i = 0; i < N; i++) {
        int x = xy[i].first;
        int y = xy[i].second;
        int indy = mpy[y];
        vi quad(4);
        dump(indy);
        quad[1] = stx.query(indy + 1, N);
        quad[2] = stx.query(0, indy);
        quad[0] = stall.query(indy + 1, N) - quad[1];
        quad[3] = stall.query(0, indy) - quad[2];
        for (int bit = 0; bit < 16; bit++) {
            vi b(4);
            for (int j = 0; j < 4; j++) {
                b[j] = ((bit >> j) & 1);
            }
            modll tmp = 1;
            for (int j = 0; j < 4; j++) {
                if (b[j] == 1) {
                    tmp *= (modpow(modll(2), quad[j]) - 1);
                }
            }
            if ((b[0] == 1 && b[2] == 1) || (b[1] == 1 && b[3] == 1)) {
                ans += tmp * 2;
            } else {
                ans += tmp;
            }
            dump(b, quad, ans);
        }
        stx.add(indy, 1);
        dump(quad);
    }
    cout << ans << endl;
}

Measured memory_bytes: 41316