#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

template<int mod>
struct ModInt {
    int x;
 
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
 
    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }
 
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
 
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
 
    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }
 
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }
 
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};
 
using modint = ModInt<mod>;
 
const int M_N=300000;
 
struct BIT{
    //1-indexed
    int n;
    modint bit[M_N+1];
    //iまでの総和を返す
    modint sum(int i){
        modint s=0;
        while(i>0){
            s+=bit[i];
            i=i&(i-1);
        }
        return s;
    }
    //iにx加算する
    void add(int i,modint x){
        while(i<=n){
            bit[i]+=x;
            i+=i&-i;
        }
    }
 
};

modint fpow(modint a, LL n){
    modint x = 1;
    while(n > 0){
        if(n&1){
            x=x*a;
        }
        a=a*a;
        n >>= 1;
    }
    return x;
}


int main(){
    LL n;cin >> n;
    vector<LL> x(n),y(n);
    vector<P> v(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        v[i] = mp(x[i],y[i]);
    }
    sort(ALL(x));
    sort(ALL(y));
    sort(ALL(v));
    BIT bit1;
    bit1.n=n+1;
    BIT bit2;
    bit2.n=n+1;
    for (int i = 1; i <= n; i++) {
        bit2.add(i,1);
    }
    modint ans = 0;
    for (int i = 0; i < n; i++) {
        int xx = lower_bound(ALL(x),v[i].fs) - x.begin() + 1;
        int yy = lower_bound(ALL(y),v[i].sc) - y.begin() + 1;
        bit2.add(yy,-1);
        ans += fpow(2,n-1);
        modint a = bit1.sum(yy), b = -a + i, c = bit2.sum(yy), d = -c -a -b + n - 1;
        ans += (fpow(2,a.x)-1) * (fpow(2,d.x)-1) * fpow(2,b.x+c.x) + (fpow(2,b.x) - 1) * (fpow(2,c.x) - 1) * (fpow(2,a.x) + fpow(2,d.x) - 1);
        bit1.add(yy,1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8832