#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
template <typename Abelian>
struct BIT {
  BIT(int n, const Abelian UNITY = 0) : n(n), UNITY(UNITY), dat(n, UNITY) {}

  void add(int idx, Abelian value) {
    while (idx < n) {
      dat[idx] += value;
      idx |= idx + 1;
    }
  }

  Abelian sum(int idx) {
    Abelian res = UNITY;
    while (idx >= 0) {
      res += dat[idx];
      idx = (idx & (idx + 1)) - 1;
    }
    return res;
  }

  Abelian sum(int left, int right) { return sum(right) - sum(left - 1); }

  int lower_bound(Abelian value) {
    if (value <= UNITY) return 0;
    int res = 0, exponent = 1;
    while (exponent <= n) exponent <<= 1;
    for (int mask = exponent >> 1; mask > 0; mask >>= 1) {
      if (res + mask - 1 < n && dat[res + mask - 1] < value) {
        value -= dat[res + mask - 1];
        res += mask;
      }
    }
    return res;
  }

private:
  int n;
  const Abelian UNITY;
  vector<Abelian> dat;
};

long long mod_pow(long long base, long long exponent, long long mod = MOD) {
  base %= mod;
  long long res = 1;
  while (exponent > 0) {
    if (exponent & 1) (res *= base) %= mod;
    (base *= base) %= mod;
    exponent >>= 1;
  }
  return res;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<pair<int, int> > xy(n);
  vector<int> x(n), y(n);
  REP(i, n) {
    cin >> x[i] >> y[i];
    xy[i] = {x[i], y[i]};
  }
  sort(ALL(x));
  x.erase(unique(ALL(x)), x.end());
  sort(ALL(y));
  y.erase(unique(ALL(y)), y.end());
  REP(i, n) {
    xy[i].first = lower_bound(ALL(x), xy[i].first) - x.begin();
    xy[i].second = lower_bound(ALL(y), xy[i].second) - y.begin();
  }
  sort(ALL(xy));
  long long ans = n * mod_pow(2, n - 1) % MOD;
  BIT<int> left(n), right(n);
  REP(i, n) right.add(i, 1);
  REP(i, n) {
    int x = xy[i].first, y = xy[i].second;
    right.add(y, -1);
    int lu = left.sum(y + 1, n - 1), ru = right.sum(y + 1, n - 1);
    int ld = left.sum(0, y - 1), rd = right.sum(0, y - 1);
    // cout << lu << ' ' << ru << ' ' << ld << ' ' << rd << '\n';
    (ans += (mod_pow(2, ld) - 1) * (mod_pow(2, ru) - 1) % MOD * mod_pow(2, lu + rd) % MOD) %= MOD;
    (ans += (mod_pow(2, lu) - 1) * (mod_pow(2, rd) - 1) % MOD * mod_pow(2, ru + ld) % MOD) %= MOD;
    ans -= (mod_pow(2, ld) - 1) * (mod_pow(2, ru) - 1) % MOD * (mod_pow(2, lu) - 1) % MOD * (mod_pow(2, rd) - 1) % MOD;
    (ans += MOD) %= MOD;
    left.add(y, 1);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4992