#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

template< typename T >
struct Compress {
  vector< T > xs;

  Compress() = default;

  Compress(const vector< T > &vs) {
    add(vs);
  }

  Compress(const initializer_list< vector< T > > &vs) {
    for(auto &p : vs) add(p);
  }

  void add(const vector< T > &vs) {
    copy(begin(vs), end(vs), back_inserter(xs));
  }

  void add(const T &x) {
    xs.emplace_back(x);
  }

  void build() {
    sort(begin(xs), end(xs));
    xs.erase(unique(begin(xs), end(xs)), end(xs));
  }

  vector< int > get(const vector< T > &vs) const {
    vector< int > ret;
    transform(begin(vs), end(vs), back_inserter(ret), [&](const T &x) {
      return lower_bound(begin(xs), end(xs), x) - begin(xs);
    });
    return ret;
  }

  int get(const T &x) const {
    return lower_bound(begin(xs), end(xs), x) - begin(xs);
  }

  const T &operator[](int k) const {
    return xs[k];
  }
};

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

const ll mod=998244353;
//const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a%=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  vector<int> x(n),y(n);
  rep(i,n) cin >> x[i] >> y[i];
  Compress<int> comp(y);
  comp.build();
  rep(i,n) y[i] = comp.get(y[i]);
  vector<pair<int,int> > cor(n);
  rep(i,n) cor[i] = {x[i],y[i]};
  sort(cor.begin(),cor.end());

  BinaryIndexedTree< int > bitl(n+1), bitr(n+1);
  rep(i,n){
    bitr.add(cor[i].second,1);
    //    cout << cor[i].first << " " << cor[i].second << endl;
  }
  ll ans = mu(pw(2,n-1),n);
  rep(i,n){    
    int y = cor[i].second;
    bitr.add(y,-1);
    ll a = bitl.sum(y);
    ll c = bitl.sum(n) - a;
    ll d = bitr.sum(y);
    ll b = bitr.sum(n) - d;
    //    cout << a << " "  << b << " " << c << " " << d << endl;
    //  ans = ad(ans,pw(2,n-1) );//中心あり
    
    ans = ad(mu(mu(ad(pw(2,a),mod-1),ad(pw(2,b),mod-1)),mu(pw(2,c),pw(2,d))),ans);
    ans = ad(mu(mu(ad(pw(2,c),mod-1),ad(pw(2,d),mod-1)),mu(pw(2,a),pw(2,b))),ans);
    ans = ad(mod - mu(mu(ad(pw(2,c),mod-1),ad(pw(2,d),mod-1)),mu(ad(pw(2,a),mod-1),ad(pw(2,b),mod-1))),ans);
    
    /*    ans = ad(ans,mu(mu(c,d),ad(ad(pw(2,a),pw(2,b)), mod-1)) );
    ans = ad(ans,mu(mu(a,b),ad(ad(pw(2,c),pw(2,d)), mod-1)) );
    ans = ad(ans,mu(a,ad(ad(pw(2,c),pw(2,d)), mod-1)) );
    ans = ad(ans,mu(b,ad(ad(pw(2,c),pw(2,d)), mod-1)) );
    ans = ad(ans,mu(c,ad(ad(pw(2,a),pw(2,b)), mod-1)) );
    ans = ad(ans,mu(d,ad(ad(pw(2,a),pw(2,b)), mod-1)) );
    */
    bitl.add(y,1);
    //    cout << ans << endl;
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 5876