#include <bits/stdc++.h>
using namespace std;

template <typename T>
struct BIT {
    int n;
    vector<T> data;

    BIT(int n) : n(n), data(n + 1) {}
    void add(int a, T w) {
        for (int x = ++a; x <= n; x += x & -x) data[x] += w;
    }
    // [0, a)
    T sum(int a) {
        T ret = 0;
        for (int x = a; x > 0; x -= x & -x) ret += data[x];
        return ret;
    }
};

template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }

    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }

    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};

using mint = ModInt<998244353>;
mint pow2[202020];

int main() {
    int n;
    cin >> n;

    vector<tuple<int, int, int>> as;
    map<int, int> xmp, ymp;
    pow2[0] = 1;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        xmp[a], ymp[b];
        as.emplace_back(a, b, 0);
        pow2[i + 1] = pow2[i] * 2;
    }
    {
        int N = 0;
        for (auto& p : xmp) {
            p.second = N++;
        }
    }
    {
        int N = 0;
        for (auto& p : ymp) {
            p.second = N++;
        }
    }
    for (int i = 0; i < n; i++) {
        get<0>(as[i]) = xmp[get<0>(as[i])];
        get<1>(as[i]) = ymp[get<1>(as[i])];
    }

    sort(as.begin(), as.end());
    for (int i = 0; i < n; i++) {
        get<2>(as[i]) = i;
    }
    vector<pair<int, int>> left;
    sort(as.begin(), as.end(), [](auto& a, auto& b) { return get<1>(a) < get<1>(b); });
    vector<int> lft(n);
    for (int i = 0; i < n; i++) {
        lft[get<2>(as[i])] = i;
    }

    sort(as.begin(), as.end());

    BIT<int> bit(n);

    mint ans = 0;

    for (int i = 0; i < n; i++) {
        int x = get<0>(as[i]), y = get<1>(as[i]);
        int l = lft[i], r = n - 1 - l;
        int u = i, d = n - 1 - u;
        int ul = bit.sum(y);
        bit.add(y, 1);
        int ur = u - ul;
        int dl = l - ul;
        int dr = d - dl;

        mint tmp = pow2[n] - 1;
        tmp -= pow2[l];
        tmp -= pow2[r];
        tmp -= pow2[u];
        tmp -= pow2[d];
        tmp += pow2[ul];
        tmp += pow2[ur];
        tmp += pow2[dl];
        tmp += pow2[dr];
        ans += tmp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 24368