#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) { return *this *= p.inverse(); }
  ModInt operator-() const { return ModInt() - *this; }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b) t = a / b, swap(a -= t * b, b), swap(u -= t * v, v);
    return ModInt(u);
  }
  ModInt pow(int64_t e) const {
    ModInt ret(1);
    for (ModInt b = *this; e; e >>= 1, b *= b)
      if (e & 1) ret *= b;
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int modulo() { return mod; }
};

struct WaveletMatrix {
  struct SuccinctIndexableDictionary {
    size_t length;
    size_t blocks;
    vector<unsigned> bit, sum;
    SuccinctIndexableDictionary() = default;
    SuccinctIndexableDictionary(size_t length)
        : length(length), blocks((length + 31) >> 5) {
      bit.assign(blocks, 0U);
      sum.assign(blocks, 0U);
    }
    void set(int k) { bit[k >> 5] |= 1U << (k & 31); }
    void build() {
      sum[0] = 0U;
      for (size_t i = 1; i < blocks; i++)
        sum[i] = sum[i - 1] + __builtin_popcount(bit[i - 1]);
    }
    bool operator[](int k) { return (bool((bit[k >> 5] >> (k & 31)) & 1)); }
    int rank(int k) {
      return (sum[k >> 5]
              + __builtin_popcount(bit[k >> 5] & ((1U << (k & 31)) - 1)));
    }
    int rank(bool val, int k) { return (val ? rank(k) : k - rank(k)); }
  };

 private:
  unsigned sigma, height;
  size_t length;
  vector<SuccinctIndexableDictionary> matrix;
  vector<int> mid;

 private:
  pair<int, int> succ(bool f, int l, int r, int level) {
    return {matrix[level].rank(f, l) + mid[level] * f,
            matrix[level].rank(f, r) + mid[level] * f};
  }

 public:
  WaveletMatrix() = default;
  WaveletMatrix(vector<int> v)
      : WaveletMatrix(v, *max_element(v.begin(), v.end()) + 1) {}
  WaveletMatrix(vector<int> v, unsigned s) : sigma(s), length(v.size()) {
    height = 32 - __builtin_clz(sigma);
    matrix.resize(height);
    mid.resize(height);
    vector<int> l(length), r(length);
    for (int level = height - 1; level >= 0; level--) {
      matrix[level] = SuccinctIndexableDictionary(length + 1);
      int left = 0, right = 0;
      for (size_t i = 0; i < length; i++) {
        if (((v[i] >> level) & 1))
          matrix[level].set(i), r[right++] = v[i];
        else
          l[left++] = v[i];
      }
      mid[level] = left;
      matrix[level].build();
      v.swap(l);
      for (int i = 0; i < right; i++) v[left + i] = r[i];
    }
  }
  // v[k]
  int access(int k) {
    int ret = 0;
    for (int level = height - 1; level >= 0; level--) {
      bool f = matrix[level][k];
      if (f) ret |= 1 << level;
      k = matrix[level].rank(f, k) + mid[level] * f;
    }
    return ret;
  }
  int operator[](int k) { return access(k); }
  // count i s.t. (0 <= i < r) && v[i] == x
  int rank(int x, int r) {
    int l = 0;
    for (int level = height - 1; level >= 0; level--)
      tie(l, r) = succ((x >> level) & 1, l, r, level);
    return r - l;
  }
  // k-th(0-indexed) smallest number in v[l,r)
  int kth_smallest(int l, int r, int k) {
    assert(0 <= k && k < r - l);
    int ret = 0;
    for (int level = height - 1; level >= 0; level--) {
      int cnt = matrix[level].rank(false, r) - matrix[level].rank(false, l);
      bool f = cnt <= k;
      if (f) ret |= 1 << level, k -= cnt;
      tie(l, r) = succ(f, l, r, level);
    }
    return ret;
  }
  // k-th(0-indexed) largest number in v[l,r)
  int kth_largest(int l, int r, int k) {
    return kth_smallest(l, r, r - l - k - 1);
  }
  // count i s.t. (l <= i < r) && (v[i] < upper)
  int range_freq(int l, int r, int upper) {
    upper = min(upper, (int)sigma);
    int ret = 0;
    for (int level = height - 1; level >= 0; level--) {
      bool f = ((upper >> level) & 1);
      if (f) ret += matrix[level].rank(false, r) - matrix[level].rank(false, l);
      tie(l, r) = succ(f, l, r, level);
    }
    return ret;
  }
  // count i s.t. (l <= i < r) && (lower <= v[i] < upper)
  int range_freq(int l, int r, int lower, int upper) {
    return range_freq(l, r, upper) - range_freq(l, r, lower);
  }
  // max v[i] s.t. (l <= i < r) && (v[i] < upper)
  int prev_value(int l, int r, int upper) {
    int cnt = range_freq(l, r, upper);
    return cnt == 0 ? -1 : kth_smallest(l, r, cnt - 1);
  }
  // min v[i] s.t. (l <= i < r) && (lower <= v[i])
  int next_value(int l, int r, int lower) {
    int cnt = range_freq(l, r, lower);
    return cnt == r - l ? -1 : kth_smallest(l, r, cnt);
  }
};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  using Mint = ModInt<998244353>;
  int N;
  cin >> N;
  pair<int, int> ps[N];
  int ys[N];
  for (int i = 0; i < N; i++) {
    cin >> ps[i].first >> ps[i].second;
    ys[i] = ps[i].second;
  }
  sort(ps, ps + N);
  sort(ys, ys + N);
  auto id = [&](int y) { return lower_bound(ys, ys + N, y) - ys; };
  vector<int> y(N);
  for (int i = 0; i < N; i++) y[i] = id(ps[i].second);
  WaveletMatrix wm(y);
  Mint M2(2);
  Mint ans = 0;
  for (int i = 0; i < N; i++) {
    int A = wm.range_freq(0, i, y[i]);
    int B = wm.range_freq(i + 1, N, y[i]);
    int C = N - i - 1 - B;
    int D = i - A;
    Mint tmp = 0;
    tmp += (M2.pow(A) - 1) * (M2.pow(C) - 1) * M2.pow(B + D)
           + (M2.pow(B) - 1) * (M2.pow(D) - 1) * M2.pow(A + C);
    tmp -= (M2.pow(A) - 1) * (M2.pow(C) - 1) * (M2.pow(B) - 1)
           * (M2.pow(D) - 1);
    tmp += M2.pow(N - 1);
    ans += tmp;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 10300