#include<bits/stdc++.h>


#include <cassert>
#include <numeric>
#include <type_traits>

namespace atcoder {

namespace internal {

#ifndef _MSC_VER
template <class T>
using is_signed_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value ||
                                  std::is_same<T, __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int128 =
    typename std::conditional<std::is_same<T, __uint128_t>::value ||
                                  std::is_same<T, unsigned __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using make_unsigned_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value,
                              __uint128_t,
                              unsigned __int128>;

template <class T>
using is_integral = typename std::conditional<std::is_integral<T>::value ||
                                                  is_signed_int128<T>::value ||
                                                  is_unsigned_int128<T>::value,
                                              std::true_type,
                                              std::false_type>::type;

template <class T>
using is_signed_int = typename std::conditional<(is_integral<T>::value &&
                                                 std::is_signed<T>::value) ||
                                                    is_signed_int128<T>::value,
                                                std::true_type,
                                                std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<(is_integral<T>::value &&
                               std::is_unsigned<T>::value) ||
                                  is_unsigned_int128<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<
    is_signed_int128<T>::value,
    make_unsigned_int128<T>,
    typename std::conditional<std::is_signed<T>::value,
                              std::make_unsigned<T>,
                              std::common_type<T>>::type>::type;

#else

template <class T> using is_integral = typename std::is_integral<T>;

template <class T>
using is_signed_int =
    typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<is_integral<T>::value &&
                                  std::is_unsigned<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<is_signed_int<T>::value,
                                              std::make_unsigned<T>,
                                              std::common_type<T>>::type;

#endif

template <class T>
using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;

template <class T>
using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;

template <class T> using to_unsigned_t = typename to_unsigned<T>::type;

}  // namespace internal

}  // namespace atcoder

#include <cassert>
#include <vector>

namespace atcoder {

// Reference: https://en.wikipedia.org/wiki/Fenwick_tree
template <class T> struct fenwick_tree {
    using U = internal::to_unsigned_t<T>;

  public:
    fenwick_tree() : _n(0) {}
    fenwick_tree(int n) : _n(n), data(n) {}

    void add(int p, T x) {
        assert(0 <= p && p < _n);
        p++;
        while (p <= _n) {
            data[p - 1] += U(x);
            p += p & -p;
        }
    }

    T sum(int l, int r) {
        assert(0 <= l && l <= r && r <= _n);
        return sum(r) - sum(l);
    }

  private:
    int _n;
    std::vector<U> data;

    U sum(int r) {
        U s = 0;
        while (r > 0) {
            s += data[r - 1];
            r -= r & -r;
        }
        return s;
    }
};

}  // namespace atcoder

#define ll long long int
#define rep(i,n) for(ll i=0;i<n;i++)
#define vec vector<ll>
#define mat vector<vector<ll>>

using namespace std;
using namespace atcoder;

const ll mod=998244353;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

ll powmod(ll a,ll n,ll m) {
    if(n == 0)
        return 1;

    if(n % 2 ==0){
        ll r = powmod(a,n/2,m);
        return r*r % m;
    }

    return a*powmod(a,n-1,m)%m;
}

ll factmod(ll a,ll b,ll m) {
  if(a<b)return 0;
  ll s=1;
  while(a>=b){
    s = s*a % m;
    a -= 1;
  }
  return s;
}

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

ll combmod(ll a,ll b,ll m){
  if(b==0)return 1;
  ll c=factmod(a,a-b+1,m);
  ll d=modinv(factmod(b,1,m),m);
  ll e=(c*d)%m;
  return e;
}

void modsum(ll &a,ll b,ll m){
  a+=b;
  a%=m;
}

void modsub(ll &a,ll b,ll m){
  a-=b;
  a+=m;
  a%=m;
}

void modmul(ll &a,ll b,ll m){
  a*=b;
  a%=m;
}

void modquo(ll &a,ll b,ll m){
  a*=modinv(b,m);
  a%=m;
}

int main(){

  ll n;
  cin >> n;

  vec x(n),y(n);
  vec X,Y;
  for(ll i=0;i<n;i++){
    cin >> x[i] >> y[i];
    X.push_back(x[i]);
    Y.push_back(y[i]);
  }

  sort(X.begin(),X.end());
  X.erase(unique(X.begin(),X.end()),X.end());  
  sort(Y.begin(),Y.end());
  Y.erase(unique(Y.begin(),Y.end()),Y.end());

  for(ll i=0;i<n;i++){
    x[i]=lower_bound(X.begin(),X.end(),x[i])-X.begin();
    y[i]=lower_bound(Y.begin(),Y.end(),y[i])-Y.begin();
  }

  mat z(n);

  for(ll i=0;i<n;i++)z[i]={y[i],x[i],i};
  sort(z.begin(),z.end());
  vec u(n);//i番目の点より下にある点(自分自身は除く)
  for(ll i=0;i<n;i++)u[z[i][2]]=i;

  for(ll i=0;i<n;i++)z[i]={x[i],y[i],i};
  sort(z.begin(),z.end());
  vec l(n);//i番目の点より左にある点(自分自身は除く)
  for(ll i=0;i<n;i++)l[z[i][2]]=i;

  //for(ll i=0;i<n;i++)cout << x[i] << " " << y[i] << endl;
 
  fenwick_tree<ll> T(n);
  vec sw(n);//i番目の点から左かつ下にある点の個数(自分自身は除く)
  for(ll i=0;i<n;i++){
    ll a=z[i][0],b=z[i][1],c=z[i][2];
    //cout << b << endl;
    T.add(b,1);
    sw[c]=T.sum(0,b);
  }

  vec tp(n+1);//powmod(i)を記憶
  tp[0]=1;
  for(ll i=0;i<n;i++){
    tp[i+1]=tp[i]*2%mod;
  }

  ll ans=0;
  for(ll i=0;i<n;i++){
    ll s=tp[n];
    modsub(s,tp[l[i]]-1,mod);
    modsub(s,tp[n-1-l[i]]-1,mod);
    modsub(s,tp[u[i]]-1,mod);
    modsub(s,tp[n-1-u[i]]-1,mod);
    ll ne,nw,se;
    nw=l[i]-sw[i];
    se=u[i]-sw[i];
    ne=n-1-sw[i]-nw-se;
    modsum(s,tp[sw[i]]-1,mod);
    modsum(s,tp[se]-1,mod);
    modsum(s,tp[ne]-1,mod);
    modsum(s,tp[nw]-1,mod);
    modsub(s,1,mod); 
    modsum(ans,s,mod);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 28264