#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
const ll mod = 998244353;
struct SegmentTree {
private:
    int n;
    vector<ll> node;
 
public:
    SegmentTree() {
        int sz = 200010;
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        for(int i=0; i<sz; i++) node[i+n-1] = 0;
        for(int i=n-2; i>=0; i--) node[i] = (node[2*i+1] + node[2*i+2]);
    }
 
    void add(int x, int val) {
        x += (n - 1);
        node[x] += val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = (node[2*x+1] + node[2*x+2]);
        }
    }
    // hannkaikukann 
    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];
 
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return (vl + vr);
    }
};

ll xnum[201000];
ll ynum[201000];
vector<ll> X[201000], Y[201000];
ll beki[201000];
ll ans;

int main() {
    beki[0] = 1;
    for(ll i = 1; i <= 2e5; i++) {
        beki[i] = beki[i-1] * 2 % mod;
    }
    ll N;
    cin >> N;
    ans = N * beki[N] % mod;
    ans = (ans + mod - N) % mod;
    vector<ll> x(N), y(N);
    vector<ll> cmpx, cmpy;
    for(int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
        cmpx.push_back(x[i]);
        cmpy.push_back(y[i]);
    }
    sort(cmpx.begin(), cmpx.end());
    cmpx.erase(unique(cmpx.begin(), cmpx.end()), cmpx.end());
    sort(cmpy.begin(), cmpy.end());
    cmpy.erase(unique(cmpy.begin(), cmpy.end()), cmpy.end());
    for(int i = 0; i < N; i++) {
        auto itr = lower_bound(cmpx.begin(), cmpx.end(), x[i]);
        x[i] = itr - cmpx.begin();
        itr = lower_bound(cmpy.begin(), cmpy.end(), y[i]);
        y[i] = itr - cmpy.begin();
        xnum[x[i]]++;
        ynum[y[i]]++;
        X[x[i]].push_back(y[i]);
        Y[y[i]].push_back(x[i]);
    }
    SegmentTree seg;
    for(ll x = 0; x <= N; x++) {
        ll Left = seg.getsum(0, N);
        for(auto y : X[x]) {
            ans += mod - beki[Left];
            ll Down = seg.getsum(0, y);
            ll Up = seg.getsum(y, N + 1);
            //cerr << x << " " << y << " " << Left << " " << Up << " " << Down << endl;
            ans += beki[Down];
            ans += beki[Up];
            ans %= mod;
        }
        for(auto y : X[x]) {
            seg.add(y, 1);
        }
    }
    seg = SegmentTree();
    for(ll x = N; x >= 0; x--) {
        ll Left = seg.getsum(0, N);
        for(auto y : X[x]) {
            ans += mod - beki[Left];
            ll Down = seg.getsum(0, y);
            ll Up = seg.getsum(y, N + 1);
            ans += beki[Down];
            ans += beki[Up];
            ans %= mod;
            //cerr << x << " " << y << " " << Left << " " << Up << " " << Down << endl;
        }
        for(auto y : X[x]) {
            seg.add(y, 1);
        }
    }
    ll sum = 0;
    for(ll y = 0; y <= N; y++) {
        ll Up = sum;
        ll Down = N - sum - ynum[y];
        for(auto tmp : Y[y]) {
            //cerr << y << " " << tmp << " " << Up << " " << Down << endl;
            ans += mod - beki[Up];
            ans += mod - beki[Down];
            ans %= mod;
        }
        sum += ynum[y];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 44240