//
//  main.cpp
//  ABC136F
#include <iostream>
#include <vector>
#include <map>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

// auto mod int 自動の％
//const int mod = 1000000007;
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;}

// Binary Indexed Tree (Fenwick Tree)
//    使い方 : BIT<int>bit
template<typename T> // T: type of cost
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) {
            d[i] += x;
        }
    }
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i&-i) {
            x += d[i];
        }
        return x;
    }
};
mint f(int a,int b,int c,int d){
    mint res=0;
    vector<int> num={a,b,c,d};
    vector<mint>o(4),ox(4);
    rep(i,4){
        ox.at(i)=mint(2).pow(num.at(i));
        o.at(i)=ox.at(i)-1;
    }
    res += ox.at(0)*o.at(1)*o.at(2)*ox.at(3);
    res += o.at(0)*ox.at(1)*ox.at(2)*o.at(3);
    res -= o.at(0)*o.at(1)*o.at(2)*o.at(3);
    res +=ox.at(0)*ox.at(1)*ox.at(2)*ox.at(3);
    return res;
}
int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    vector<P>p(n);
    rep(i,n) cin>>p.at(i).first >> p.at(i).second;
    { // compress x
        map<int,int>mp;
        rep(i,n) mp[p.at(i).first]=0;
        int j=0;
        for(auto&& x:mp) x.second=j++;
        rep(i,n) p.at(i).first = mp[p.at(i).first];
    }
    { // compress y
        map<int,int>mp;
        rep(i,n) mp[p.at(i).second]=0;
        int j=0;
        for(auto&& x:mp) x.second=j++;
        rep(i,n) p.at(i).second = mp[p.at(i).second];
    }
    sort(p.begin(),p.end());
    vector<int>a(n);
    vector<int>b(n);
    vector<int>c(n);
    vector<int>d(n);
    rep(_,2){
        {
            BIT<int> bit(n);
            rep(i,n){
                a.at(i)=bit.sum(p.at(i).second);
                b.at(i)=i-a.at(i);
                bit.add(p.at(i).second);
            }
        }
        reverse(p.begin(), p.end());
        swap(a,c);
        swap(b,d);
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        reverse(c.begin(), c.end());
        reverse(d.begin(), d.end());
    }
    mint ans=0;
    rep(i,n){
        ans+=f(a.at(i),b.at(i),c.at(i),d.at(i));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 13840