#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int n;

//auto mod int

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
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++() {
      if ((x++) >= mod) x-= mod;
      return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator--() {
      if ((x += mod-1) >= 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;
  }
};


template<class T>
struct BIT{
    int n; //length of array
    vector<T> d; //each content of BIT node
    BIT(int n=0):n(n), d(n+1){} //d is initialized by 0.
    void add(int i, T x=1){
        for(i++; i<=n; i+=i&-i){
            d[i] += x;
        }
    }
    T sum(int i){
        T ans=0;
        for(i++; i; i-=i&-i){
            ans+=d[i];
        }
        return ans;
    }

};

mint f(int a, int b, int c, int d, vector<mint> &pow2){
    mint res = 0;
    res += (pow2[a]-1)*(pow2[d]-1)*(pow2[b+c]);
    res += (pow2[b]-1)*(pow2[c]-1)*(pow2[a+d]);
    res -= (pow2[a]-1)*(pow2[b]-1)*(pow2[c]-1)*(pow2[d]-1);
    res += pow2[n-1]; //自分自身を選ぶ回数
    return res;
}

int main(){
    cin >> n;
    vector<pair<int,int>> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    vector<int> d(n);
    {
        //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());
    rep(_,2){
        BIT<int> bit(n);
        //loop for each point
        rep(i,n){
            a[i] = bit.sum(p[i].second); //今まで出てきた点(x座標が小さい点）のうち、y座標がこの点より小さいもの
            b[i] = i - a[i]; //今までi点出てきていて、aに属さないものは全てb
            bit.add(p[i].second); //今のy座標をBITに追加
        }
        swap(a,c);
        swap(b,d);
        reverse(p.begin(),p.end());
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        reverse(c.begin(),c.end());
        reverse(d.begin(),d.end());
    }

    mint ans(0);

    vector<mint> pow2(n+1);
    pow2[0]=1;
    rep(i,n) pow2[i+1] = pow2[i] * 2;
    rep(i,n){
        //cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << endl;
        ans += f(a[i],b[i],c[i],d[i], pow2);
        //cout << ans.x << endl;
    }
    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 14464