#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
//const ll mod = 1000000007LL;
const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


struct BinaryIndexed {
  ll num;
  vll bit;

  BinaryIndexed(ll x = MAX) {
    num = x;
    bit.resize(x + 1, 0);
  }

  ll sum(ll i) {
    ll ret = 0;
    while (i > 0) {
      ret += bit[i];
      i -= i & -i;
    }
    return ret;
  }

  void add(ll i, ll x) {
    if (i == 0) cout << "access 0 index" << endl;
    while (i <= num) {
      bit[i] += x;
      i += i & -i;
    }
  }
};

vll fac, inv, invfac;
void comb_set(ll x = MAX) {
  fac.resize(x + 1, 0);
  invfac.resize(x + 1, 0);
  inv.resize(x + 1, 0);
  fac[0] = inv[1] = invfac[0] = 1;
  FOR(i, 1, x + 1) (fac[i] = fac[i - 1] * i) %= mod;
  FOR(i, 2, x + 1) (inv[i] = (mod - mod / i) * inv[mod%i]) %= mod;
  FOR(i, 1, x + 1) (invfac[i] = invfac[i - 1] * inv[i]) %= mod;
}
ll comb(ll x, ll y) {
  if (x < y) return 0;
  return fac[x] * invfac[x - y] % mod * invfac[y] % mod;
}
ll mod_pow(ll x, ll y) {
  ll ret = 1;
  while (y > 0) {
    if (y & 1) ret = (x*ret) % mod;
    x = (x*x) % mod;
    y >>= 1;
  }
  return ret;
}


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


  cin >> n;
  vll x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  vpll v;
  rep(i, n) {
    v.pb(pll(x[i], y[i]));
  }
  sort(all(v));
  sort(all(y));
  MAP mp;
  comb_set(MAX);
  rep(i, n) {
    mp[y[i]] = i + 1;
  }
  BinaryIndexed le(MAX), ri(MAX);
  FOR(i, 0, n) ri.add(mp[v[i].second], 1);
  if (n == 1) {
    cout << "1" << endl;
    return 0;
  }
  (ans = n * mod_pow(2, n - 1)) %= mod;
  FOR(i, 0, n) {
    ll a, b, c, d, pos = mp[v[i].second];
    ll aa, bb, cc, dd;
    ri.add(mp[v[i].second], -1);
    aa = ri.sum(MAX - 1) - ri.sum(pos);
    bb = ri.sum(pos);
    cc = le.sum(pos);
    dd = le.sum(MAX - 1) - le.sum(pos);
    (a = mod_pow(2, aa) - 1 + mod) %= mod;
    (b = mod_pow(2, bb) - 1 + mod) %= mod;
    (c = mod_pow(2, cc) - 1 + mod) %= mod;
    (d = mod_pow(2, dd) - 1 + mod) %= mod;
    (ans += ((a*c) % mod)*mod_pow(2, n - aa - cc - 1)) %= mod;
    (ans += ((b*d) % mod)*mod_pow(2, n - bb - dd - 1)) %= mod;

    tmp = (a*b) % mod;
    (tmp *= c) %= mod;
    (tmp *= d) %= mod;
    (ans += mod - tmp) %= mod;

    le.add(pos, 1);
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 28140