#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = 998244353;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


template<typename T>
vector<int> compress(vector<T> &v) {
  vector<T> t = v;
  sort(t.begin(), t.end());
  t.erase(unique(t.begin(), t.end()), t.end());
	vector<int> r(v.size());
  for (int i = 0; i < v.size(); i++) {
    r[i] = lower_bound(t.begin(), t.end(), v[i]) - t.begin();
  }
	return r;
}

template<int MOD> struct Fp {
  long long val;
  constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
    if (val < 0) val += MOD;
  }
  constexpr int getmod() { return MOD; }
  constexpr Fp operator - () const noexcept {
    return val ? MOD - val : 0;
  }
  constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
  constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
  constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
  constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
  constexpr Fp& operator += (const Fp& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr Fp& operator -= (const Fp& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr Fp& operator *= (const Fp& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr Fp& operator /= (const Fp& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator == (const Fp& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator != (const Fp& r) const noexcept {
    return this->val != r.val;
  }
  friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
    return os << x.val;
  }
  friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
};
using mint = Fp<MOD>;


template<typename T>
struct BIT {
  int n; vector<T> d;
  BIT(int n=0) : n(n), d(n+1) {}
  void add(int i, T a=1) {
    for (i++; i <= n; i += i & -i) d[i] += a;
  }
  // sum [0, i)
  T sum(int i) {
    if (i == 0) return 0;
    T x = 0;
    for (; i > 0; i -= i & -i) x += d[i];
    return x;
  }
};


int main() {
  int n; cin >> n;
  Vll x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];

  V xu = compress(x);
  V yu = compress(y);

  vector<P> xy(n);
  rep(i, n) {
    xy[i].first = xu[i];
    xy[i].second = yu[i];
  }
  sort(ALL(xy));

  BIT<int> bit(n);
  mint ans = 0;
  mint all = modpow(mint(2), n) - 1;
  rep(i, n) {
    int x = xy[i].first;
    int y = xy[i].second;
    int le = x;
    int lo = y;
    int lole = bit.sum(y);

    int up = n - 1 - lo;
    int ri = n - 1 - le;
    int uple = le - lole;
    int upri = up - uple;
    int lori = ri - upri;

    mint z = 0;
    z += modpow(mint(2), up) - 1;
    z += modpow(mint(2), lo) - 1;
    z += modpow(mint(2), le) - 1;
    z += modpow(mint(2), ri) - 1;
    z -= modpow(mint(2), uple) - 1;
    z -= modpow(mint(2), upri) - 1;
    z -= modpow(mint(2), lole) - 1;
    z -= modpow(mint(2), lori) - 1;
    ans += all - z;

    bit.add(y);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7276