#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

typedef pair<int, int> P;

// 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;}


template<typename T>
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;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};


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[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(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    cin >> n;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;

    //Compression
    {// compress x
        map<int,int> mp;
        rep(i,n) mp[p[i].first] = 0;
        int j = 0;
        for (auto&& x : mp) x.second = j++;
        rep(i,n) p[i].first = mp[p[i].first];      
    }
    {// compress y
        map<int,int> mp;
        rep(i,n) mp[p[i].second] = 0;
        int j = 0;
        for (auto&& x : mp) x.second = j++;
        rep(i,n) p[i].second = mp[p[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){
        {// calc a, b
            BIT<int> bit(n);
            rep(i,n){
                a[i] = bit.sum(p[i].second);
                b[i] = i - a[i];
                bit.add(p[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[i],b[i],c[i],d[i]);
    }
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 14228