// 2020-08-14 20:06:13
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
const int mod = 998244353;
struct mint {
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % mod) {
    if (val < 0) val += mod;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = mod, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += mod;
    u %= mod;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= mod) val -= mod;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += mod;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % mod;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % mod;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
  friend std::string debug_s (mint a) noexcept {
    return std::to_string(a.val);
  }
};
struct FenwickTree {
  int N;
  vll bit;
  void init(int n) {
    N = n;
    bit.assign(n+2, 0);
  }
  void add(int i, ll a) {
    while(i <= N) {
      bit[i] += a;
      // chmax(bit[i], a);
      i += (i & -i);
    }
  }
  ll sum(int i) {
    ll res = 0;
    while(i > 0) {
      res += bit[i];
      // chmax(res, bit[i]);
      i -= (i & -i);
    }
    return res;
  }
  int lower_bound(ll w) {
    int k = 1;
    while(k <= N) k *= 2;
    k /= 2;
    int x = 0;
    while(k > 0) {
      if(x+k <= N && bit[x+k] < w) {
        w -= bit[x+k];
        x += k;
      }
      k /= 2;
    }
    return x+1;
  }
};

mint mpw2[200020];
void answer() {
  mpw2[0] = 1;
  rep(i, 200010) mpw2[i+1] = mpw2[i] * 2;
  int n;
  cin >> n;
  vector<P> ps(n); // x, y
  map<int, int> mpx, mpy;
  rep(i, n) {
    int x, y;
    cin >> x >> y;
    ps[i] = P(x, y);
    mpx[x] = 0;
    mpy[y] = 0;
  }
  {
    int i = 0;
    for(auto& m : mpx) m.second = ++i;
    i = 0;
    for(auto& m : mpy) m.second = ++i;
  }
  mint memo[200020][3];
  {
    FenwickTree bit;
    bit.init(n);
    sort(ALL(ps));
    for(const auto& p : ps) {
      int x, y;
      tie(x, y) = p;
      int xi = mpx[x], yi = mpy[y];
      int b = bit.sum(yi);
      int a = bit.sum(n) - b;
      memo[xi][0] = (mpw2[a] - 1) * mpw2[b];
      memo[xi][1] = mpw2[a] * (mpw2[b] - 1);
      memo[xi][2] = (mpw2[a] - 1) * (mpw2[b] - 1);
      bit.add(yi, 1);
    }
  }
  {
    FenwickTree bit;
    bit.init(n);
    sort(RALL(ps));
    for(const auto& p : ps) {
      int x, y;
      tie(x, y) = p;
      int xi = mpx[x], yi = mpy[y];
      int d = bit.sum(yi);
      int c = bit.sum(n) - d;
      memo[xi][0] *= mpw2[c] * (mpw2[d] - 1);
      memo[xi][1] *= (mpw2[c] - 1) * mpw2[d];
      memo[xi][2] *= (mpw2[c] - 1) * (mpw2[d] - 1);
      bit.add(yi, 1);
    }
  }
  mint ans = 0;
  for(const auto& p : ps) {
    int x, y;
    tie(x, y) = p;
    int xi = mpx[x], yi = mpy[y];
    ans += mpw2[n-1];
    ans += memo[xi][0];
    ans += memo[xi][1];
    ans -= memo[xi][2];
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 31352