#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint p(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[n-k];
    }
} comb(10000007);
// comb(5, 2) → 10, comb.p(5, 2) → 20
// comb.fact[4] → 24, 2のN乗 → mint(2).pow(N)

template<typename T>
struct BIT {
    int n;
    vector<T> d;
    BIT(int n=0):n(n), d(n+1) {}
    void add(int i, T x=1) {
        for (i++; i <= n; i += i&-i) {
            //i&-iで最下位bitを足している
            d[i] += x;
        }
    }
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i&-i) {
            x += d[i];
        }
        return x;
    }
    T semiopenSum(int l, int r) {
        // [l,r)の半開区間
        return sum(r-1) - sum(l-1);
    }
};  // BIT<int> bit(N);

int dir[200005][4];
const int INF = 1e9+10;

int main() {
    // warp and weft、それぞれの点の左下、右上に幾つの点があるか
    // 全部では2^N-1
    int N;
    cin >> N;
    vector<P> X, Y;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        X.emplace_back(x, i);
        Y.emplace_back(y, i);
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    vector<P> dots(N);
    for (int i = 0; i < N; i++) {
        {
            int id = X[i].second;
            dots[id].first = i;
        }
        {
            int id = Y[i].second;
            dots[id].second = i;
        }
    }
    BIT<int> bit(N);
    for (int i = 0; i < N; i++) {
        int id = X[i].second;
        int ypos = dots[id].second;
        int cnt = bit.sum(ypos);
        dir[id][2] = cnt;
        dir[id][1] = i - cnt;
        // assert (i - cnt >= 0);
        bit.add(ypos);
    }
    bit = BIT<int>(N);
    for (int i = N-1; i >= 0; i--) {
        int id = X[i].second;
        int ypos = dots[id].second;
        int cnt = bit.sum(ypos);
        dir[id][3] = cnt;
        dir[id][0] = (N-1-i) - cnt;
        bit.add(ypos);
    }
    mint ans = 0;
    mint total = mint(2).pow(N);
    rep(i, N) {
        // 0と2象限
        mint x[4];
        rep(j, 4) {
            int y = dir[i][j];
            x[j] = mint(2).pow(y) - 1;
        }
        mint temp = 0;
        // 自分自身を選ばない
        temp += x[0] * x[2] * mint(2).pow(N - 1 - (dir[i][0] + dir[i][2]));
        temp += x[1] * x[3] * mint(2).pow(N - 1 - (dir[i][1] + dir[i][3]));
        temp -= x[0] * x[1] * x[2] * x[3];
        temp += mint(2).pow(N-1); // 自分自身を選ぶ
        ans += temp;
    }
    cout << ans << '\n';
    return 0;
    // ll, 0, -, 1i, for s&g, debug
}

Measured memory_bytes: 168960