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

using ll = long long;
using p = std::pair<ll, ll>;
const ll mod = 998244353; // ここでmodの数を定義

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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};


// 累積和を扱うためのBIT
template<typename T>
struct BIT {
  int n;
  std::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;
    std::vector<int> num = {a, b, c, d};
    std::vector<mint> o(4), ox(4);
    for(int i = 0; i < 4; i++){
        ox[i] = mint(2).pow(num[i]);
        o[i] = ox[i] - 1;
    }
    res += ox[0] * o[1] * o[2] * ox[3];
    res += o[0] * ox[1] * ox[2] * o[3];
    res -= o[0] * o[1] * o[2] * o[3];
    res += ox[0] * ox[1] * ox[2] * ox[3];
    return res;
}




int main(){
    ll N;
    scanf("%lld%*c", &N);
    std::vector<p> points(N);
    for(ll i = 0; i < N; i++){
        scanf("%lld %lld%*c", &points[i].first, &points[i].second);
    }

    // xの座標圧縮
    {
        std::map<ll, ll> mp;
        for(ll i = 0; i < N; i++){
            mp[points[i].first] = 0;
        }
        int j = 0;
        for(auto &&x: mp){
            x.second = j++;
        }
        for(ll i = 0; i < N; i++){
            points[i].first = mp[points[i].first];
        }
    }
    // yの座標圧縮
    {
        std::map<ll, ll> mp;
        for(ll i = 0; i < N; i++){
            mp[points[i].second] = 0;
        }
        int j = 0;
        for(auto &&y: mp){
            y.second = j++;
        }
        for(ll i = 0; i < N; i++){
            points[i].second = mp[points[i].second];
        }
    }

    // x座標に関して小さい順にソート
    std::sort(points.begin(), points.end());

    std::vector<ll> a(N), b(N), c(N), d(N);
    for(int _; _ < 2; _++){
        { // calc a, b
            BIT<ll> bit(N);
            // 平面走査 : xの小さい順に
            for(ll i = 0; i < N; i++){
                a[i] = bit.sum(points[i].second);
                b[i] = i - a[i];

                bit.add(points[i].second);
            }
        }
        std::reverse(points.begin(), points.end());
        std::swap(a, c);
        std::swap(b, d);
        std::reverse(a.begin(), a.end());
        std::reverse(b.begin(), b.end());
        std::reverse(c.begin(), c.end());
        std::reverse(d.begin(), d.end());
    }

    mint ans = 0;
    for(int i = 0; i < N; i++){
        ans += f(a[i], b[i], c[i], d[i]);
    }
    std::cout << ans.x << std::endl;

    return 0;
}

Measured memory_bytes: 17152