#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cassert>

using namespace std;
typedef long long ll;

struct mint{
    static const long long MOD = 998244353;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

struct BIT {
    vector<ll> x;
    BIT(ll n) : x(n, 0) {}
    ll sum(ll i){
        ll s = 0;
        while(i > 0){
            s += x.at(i - 1);
            i -= i & (-i);
        }
        return s;
    }
    void add(ll i, ll v){
        i += 1;
        while(i <= x.size()){
            x.at(i - 1) += v;
            i += i & (-i);
        }
    }
};

int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> xys;
    vector<ll> xs;
    vector<ll> ys;
    for(int i = 0; i < n; ++i){
        ll x, y;
        cin >> x >> y;
        xys.push_back(make_pair(x, y));
        xs.push_back(x);
        ys.push_back(y);
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());

    map<ll, ll> x2i, y2i;
    for(ll i = 0; i < n; ++i){
        x2i[xs.at(i)] = i;
        y2i[ys.at(i)] = i;
    }

    for(ll i = 0; i < n; ++i){
        xys.at(i).first = x2i.at(xys.at(i).first);
        xys.at(i).second = y2i.at(xys.at(i).second);
    }

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

    vector<mint> p2(n + 1, 1);
    for(ll i = 1; i <= n; ++i){
        p2.at(i) = p2.at(i - 1) * 2;
    }
    for(ll i = 0; i <= n; ++i){ p2.at(i) -= 1; }

    mint ans = 0;
    BIT bit(n);
    for(ll nx = 0; nx < n; ++nx){
        assert(xys.at(nx).first == nx);
        const ll ny = xys.at(nx).second;

        const ll na = bit.sum(ny + 1);
        const ll nb = ny - na;
        const ll nc = nx - na;
        const ll nd = n - na - nb - nc - 1;

        ans += p2.at(n)
            - p2.at(na) - p2.at(nb) - p2.at(nc) - p2.at(nd)
            - (p2.at(na + nb) - p2.at(na) - p2.at(nb))
            - (p2.at(na + nc) - p2.at(na) - p2.at(nc))
            - (p2.at(nc + nd) - p2.at(nc) - p2.at(nd))
            - (p2.at(nb + nd) - p2.at(nb) - p2.at(nd));
        bit.add(ny, 1);
    }
    cout << ans.v << endl;
    return 0;
}


Measured memory_bytes: 35824