#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll const mod = 998244353;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod - a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint ret(*this);
    return ret += a;
  }
  mint operator-(const mint a) const {
    mint ret(*this);
    return ret -= a;
  }
  mint operator*(const mint a) const {
    mint ret(*this);
    return ret *= a;
  }
  mint pow(ll t) const {
    if (t == 0) return mint(1);
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint ret(*this);
    return ret /= a;
  }
};
class modutils {
  vector<mint> fact, invfact;

 public:
  modutils(int n = 200005) : fact(n + 1), invfact(n + 1) {
    fact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i;
    invfact[n] = fact[n].inv();
    for (int i = n; i >= 1; i--) invfact[i - 1] = invfact[i] * i;
  }
  mint pow(mint x, ll n) { return x.pow(n); }
  mint comb(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return fact[n] * invfact[k] * invfact[n - k];
  }
  mint perm(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return fact[n] * invfact[n - k];
  }
  mint fac(ll n) { return fact[n]; }
};

template <typename T>
struct BIT {
  ll n;
  vector<T> arr;

  BIT(const ll _n) {
    arr.assign(_n + 1, 0);
    n = arr.size();
  }

  void add(ll i, T x) {
    i++;
    while (i <= n) {
      arr[i] += x;
      i += i & (-i);
    }
  }

  T get(ll i) {
    i++;
    T ret = 0;
    while (i > 0) {
      ret += arr[i];
      i -= i & (-i);
    }
    return ret;
  }
};



int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;
  vP ps(n);
  rep(i, n) cin >> ps[i].first >> ps[i].second;
  {  // compress x
    map<ll, ll> mp;
    rep(i, n) mp[ps[i].first] = 0;
    ll j = 0;
    for (auto& x : mp) x.second = j++;
    rep(i, n) ps[i].first = mp[ps[i].first];
  }
  {  // compress y
    map<ll, ll> mp;
    rep(i, n) mp[ps[i].second] = 0;
    ll j = 0;
    for (auto& x : mp) x.second = j++;
    rep(i, n) ps[i].second = mp[ps[i].second];
  }

  Sort(ps);

  vll as(n), bs(n), cs(n), ds(n);
  {
    BIT<ll> bit(n);
    rep(i, n) {
      as[i] = bit.get(ps[i].second);
      bs[i] = i - as[i];
      bit.add(ps[i].second, 1);
    }
  }
  {
    Reverse(ps);
    BIT<ll> bit(n);
    rep(i, n) {
      cs[i] = bit.get(ps[i].second);
      ds[i] = i - cs[i];
      bit.add(ps[i].second, 1);
    }
    Reverse(cs);
    Reverse(ds);
    Reverse(ps);
  }

  auto f = [](ll a, ll b, ll c, ll d) {
    mint ret = 0;
    vll lst = {a, b, c, d};
    vector<mint> on(4), dc(4);
    rep(i, 4) {
      on[i] = mint(2).pow(lst[i]) - 1;
      dc[i] = on[i] + 1;
    }
    ret += dc[0] * on[1] * on[2] * dc[3];
    ret += on[0] * dc[1] * dc[2] * on[3];
    ret -= on[0] * on[1] * on[2] * on[3];
    ret += dc[0] * dc[1] * dc[2] * dc[3];
    return ret;
  };

  mint ans;
  rep(i, n) {
    ans += f(as[i], bs[i], cs[i], ds[i]);
  }

  cout << ans.x << endl;

  return 0;
}


Measured memory_bytes: 15872