#include <bits/stdc++.h>
using namespace std;

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 998244353;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

template<int64 mod>
struct ModInt{
  int64 x;
  constexpr ModInt(int64 y = 0):x((y%mod+mod)%mod){}
  constexpr ModInt& operator+=(const ModInt& a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator-=(const ModInt& a){
    if((x -= a.x) < 0)x += mod;
    return *this;
  }
  constexpr ModInt& operator*=(const ModInt& a){
    x = x * a.x % mod;
    return *this;
  }
  constexpr ModInt& operator/=(const ModInt& a){
    *this *= a.inv();
    return *this;
  }
  constexpr ModInt operator-() const {
    return ModInt(-x);
  }
  constexpr ModInt operator+(const ModInt& a) const {
    return ModInt(*this) += a;
  }
  constexpr ModInt operator-(const ModInt& a) const {
    return ModInt(*this) -= a;
  }
  constexpr ModInt operator*(const ModInt& a) const {
    return ModInt(*this) *= a;
  }
  constexpr ModInt operator/(const ModInt& a) const {
    return ModInt(*this) /= a;
  }
  constexpr ModInt operator++(){
    *this += ModInt(1);
    return *this;
  }
  constexpr ModInt operator++(int){
    ModInt old = *this;
    ++*this;
    return old;
  }
  constexpr ModInt operator--(){
    *this -= ModInt(1);
    return *this;
  }
  constexpr ModInt operator--(int){
    ModInt old = *this;
    --*this;
    return old;
  }
  constexpr bool operator==(const ModInt& a) const {
    return x == a.x;
  }
  constexpr bool operator!=(const ModInt& a) const {
    return x != a.x;
  }
  constexpr ModInt pow(int64 r) const {
    if(!r)return 1;
    ModInt res = pow(r>>1);
    res *= res;
    if(r & 1) res *= *this;
    return res;
  }
  constexpr ModInt inv() const {
    return pow(mod-2);
  }
  friend istream& operator>>(istream& is, ModInt& a){
    int64 t;
    is >> t;
    a = ModInt(t);
    return is;
  }
  friend ostream& operator<<(ostream& os, const ModInt& a){
    return os << a.x;
  }
};
using mint = ModInt<MOD>;

struct FenwickTree{
    vector<int> fenwick;
    int n;

    FenwickTree(int n):
        fenwick(vector<int>(n+1, 0)), n(n) {}

    int sum(int i) {
        if (!i) return 0;
        return fenwick[i] + sum(i-(i&-i));
    }

    int sum(int i, int j){
        // half-open interval
        return sum(j-1) - sum(i-1);
    }

    void add(int i, int x) {
        if (i > n) return;
        fenwick[i] += x;
        add(i+(i&-i), x);
    }
};

vector<int32> compress(int32 n, vector<int32> vec){
    vector<pii> cp(n);
    REP(i,n){
        cp[i] = pii(vec[i], i);
    }
    sort(ALL(cp));
    vector<int32> res(n);
    REP(i,n){
        res[cp[i].second] = i+1;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int32> x(n),y(n);
    REP(i,n){
        cin >> x[i] >> y[i];
    }
    x = compress(n, x);
    y = compress(n, y);
    vector<pii> p(n);
    REP(i,n)p[i] = pii(x[i], y[i]);
    sort(ALL(p));
    mint ans = mint(n) * mint(2).pow(n-1);
    FenwickTree l(n), r(n);
    REP(i,n){
        r.add(p[i].second,1);
    }
    REP(i,n){
        r.add(p[i].second, -1);
        int32 a = l.sum(1,p[i].second);
        int32 b = i - a;
        int32 c = r.sum(1,p[i].second);
        int32 d = n - i - 1 - c;
        mint at = mint(2).pow(a) - 1;
        mint bt = mint(2).pow(b) - 1;
        mint ct = mint(2).pow(c) - 1;
        mint dt = mint(2).pow(d) - 1;
        ans += at * bt * ct * dt;
        ans += at * dt;
        ans += bt * ct;
        ans += at * bt * ct;
        ans += at * bt * dt;
        ans += at * ct * dt;
        ans += bt * ct * dt;
        l.add(p[i].second,1);
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 9648