#include <bits/stdc++.h>

using namespace std;

template <class T> inline T updmax(T& a, T b) { return a = max(a, b); }
template <class T> inline T updmin(T& a, T b) { return a = min(a, b); }

template <unsigned long long mod> class modint {
  public:
    unsigned long long v;
    modint(const long long x = 0) : v(x % mod) {}
    modint operator+(const modint rhs) { return modint(*this) += rhs; }
    modint operator-(const modint rhs) { return modint(*this) -= rhs; }
    modint operator*(const modint rhs) { return modint(*this) *= rhs; }
    modint operator/(const modint rhs) { return modint(*this) /= rhs; }
    modint operator-() { return modint(mod - this->v); }
    modint& operator+=(const modint rhs) {
        v += rhs.v;
        if (v >= mod) v -= mod;
        return *this;
    }
    modint& operator-=(const modint rhs) {
        if (v < rhs.v) v += mod;
        v -= rhs.v;
        return *this;
    }
    modint& operator*=(const modint rhs) {
        v = v * rhs.v % mod;
        return *this;
    }
    modint inverse(modint a) {
        unsigned long long exp = mod - 2;
        modint ret(1ULL);
        while (exp) {
            if (exp % 2) { ret *= a; }
            a *= a;
            exp >>= 1;
        }
        return ret;
    }
    modint& operator/=(modint rhs) {
        (*this) *= inverse(rhs);
        return *this;
    }
};

const int MOD = 998244353;
using mint = modint<MOD>;

template <class T> vector<int> coordinate_compression(vector<T>& a) {
    vector<T> b{a};
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    unordered_map<T, int> val_to_idx;
    for (int i = 0; i < b.size(); i++) val_to_idx[b[i]] = i;
    vector<T> ret{a};
    for (int i = 0; i < a.size(); i++) ret[i] = val_to_idx[ret[i]];
    return ret;
}

// 0-indexed
template <class T> class SegmentTree {
    int size;
    T def;
    vector<T> data;
    function<T(T, T)> f;

  public:
    SegmentTree<T>(int _size, T _def, function<T(T, T)> _f) : f(_f), def(_def), size(1) {
        while (size < _size) size <<= 1;
        data = vector<T>(size * 2, def);
    }
    // bottom-up implementation
    // query for[l, r)
    T query(int l, int r) {
        T L = def, R = def;
        for (l += size, r += size; l < r; l >>= 1, r >>= 1) {
            if (l & 1) L = f(L, data[l++]);
            if (r & 1) R = f(data[--r], R);
        }
        return f(L, R);
    }
    void update(int idx, T val) {
        idx += size;
        data[idx] = val;
        while (idx > 1) {
            idx >>= 1;
            data[idx] = f(data[2 * idx], data[2 * idx + 1]);
        }
    }
    T operator[](int idx) { return data[idx + size]; }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> x(n, 0), y(n, 0);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    x = coordinate_compression(x);
    y = coordinate_compression(y);
    vector<pair<int, int>> xy(n);
    for (int i = 0; i < n; i++) xy[i] = make_pair(x[i], y[i]);
    sort(xy.begin(), xy.end());
    vector<mint> pow2(n + 1, 1);
    for (int i = 1; i <= n; i++) pow2[i] = pow2[i - 1] * 2;
    mint ret = pow2[n - 1] * n;
    SegmentTree<int> l(n, 0, [](int a, int b) { return a + b; }), r(n, 0, [](int a, int b) { return a + b; });
    for (int i = 0; i < n; i++) r.update(i, 1);
    for (int i = 0; i < n; i++) {
        int sz1 = l.query(0, xy[i].second);
        int sz2 = l.query(xy[i].second + 1, n);
        int sz3 = r.query(0, xy[i].second);
        int sz4 = r.query(xy[i].second + 1, n);
        for (int j = 0; j < 16; j++) {
            if ((j & 9) == 9 || (j & 6) == 6) {
                mint tmp = 1;
                if (j & 1) tmp *= pow2[sz1] - 1;
                if (j & 2) tmp *= pow2[sz2] - 1;
                if (j & 4) tmp *= pow2[sz3] - 1;
                if (j & 8) tmp *= pow2[sz4] - 1;
                ret += tmp;
            }
        }
        l.update(xy[i].second, 1);
        r.update(xy[i].second, 0);
    }
    cout << ret.v << endl;
    return 0;
}

Measured memory_bytes: 11612