#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

// Does coordinate compression.
// Arguments:
// - raw_xs: Values to compress.
// Returns:
// - xs: Compressed values.
// - to_raw: A mapping from a compressed value to a raw value.
// Verified: CF573Div1D
tuple<vector<int>, vector<int>> Compress(const vector<int>& raw_xs) {
  unordered_set<int> raw_x_set(raw_xs.begin(), raw_xs.end());
  vector<int> to_raw(raw_x_set.begin(), raw_x_set.end());
  sort(to_raw.begin(), to_raw.end());
  unordered_map<int, int> to_index;
  for (int i = 0; i < to_raw.size(); i++) {
    to_index[to_raw[i]] = i;
  }
  vector<int> xs;
  for (int raw_x : raw_xs) {
    xs.push_back(to_index[raw_x]);
  }
  return make_tuple(xs, to_raw);
}

constexpr int64 P = 998244353;

// Verified: ABC133E, ABC132D, ABC130E
struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 input_x) : x(input_x) {}
  FiniteField() : x(0) {}
  int64 Value() { return x; }
  inline FiniteField operator+(FiniteField o) {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

// Supports two operations.
// - Updates a single element.
// - Returns a sum of a range.
// Verified: CF573Div1D
class BinaryIndexedTree {
 private:
  int n;
  vector<int> xs;
 public:
  BinaryIndexedTree(int in_n) : n(in_n), xs(in_n) {}

  // Adds x to the i-th element.
  void Add(int i, int x) {
    int cur = i;
    while (cur < n) {
      xs[cur] += x;
      cur = cur | (cur + 1);
    }
  }

  // Returns a sum of a range [l r).
  int SumRange(int l, int r) {
    if (l >= r) return 0;
    if (l > 0) {
      return SumRange(0, r) - SumRange(0, l);
    }
    int s = 0;
    int i = r - 1;
    while (i >= 0) {
      s += xs[i];
      i = (i & (i + 1)) - 1;
    }
    return s;
  }
};

struct Int2D {
  int x, y;
};

constexpr int DEBUG = 0;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  vector<int> raw_xs(n), raw_ys(n);
  for (int i = 0; i < n; i++) {
    cin >> raw_xs[i];
    cin >> raw_ys[i];
  }
  
  vector<int> xs, ys;
  tie(xs, ignore) = Compress(raw_xs);
  tie(ys, ignore) = Compress(raw_ys);

  vector<Int2D> ps;
  for (int i = 0; i < n; i++) {
    ps.push_back(Int2D({xs[i], ys[i]}));
  }
  sort(ps.begin(), ps.end(), [](Int2D p1, Int2D p2) {
    return p1.y < p2.y;
  });

  function<int(int, int)> merge_fn = [](int x, int y) { return x + y; };
  int empty_value = 0;

  BinaryIndexedTree l_tree(n);
  BinaryIndexedTree u_tree(n);
  for (int i = 0; i < n; i++) {
    u_tree.Add(i, 1);
  }

  vector<FiniteField> two_powers(n + 1);
  two_powers[0] = 1;
  for (int i = 1; i <= n; i++) two_powers[i] = two_powers[i - 1] * 2;

  FiniteField ans = 0;
  for (int i = 0; i < n; i++) {
    ans += two_powers[n] - 1;
    if (DEBUG) cout << ans.Value() << endl;

    // u_tree.Update(ps[i].x, 0);
    u_tree.Add(ps[i].x, -1);

    int ll = l_tree.SumRange(0, ps[i].x);
    int ul = l_tree.SumRange(ps[i].x + 1, n);
    int lu = u_tree.SumRange(0, ps[i].x);
    int uu = u_tree.SumRange(ps[i].x + 1, n);
    ans -= two_powers[ll + lu] - 1;
    ans -= two_powers[ul + uu] - 1;
    ans -= two_powers[ll + ul] - 1;
    ans -= two_powers[lu + uu] - 1;
    ans += two_powers[ll] - 1;
    ans += two_powers[ul] - 1;
    ans += two_powers[lu] - 1;
    ans += two_powers[uu] - 1;

    // l_tree.Update(ps[i].x, 1);
    l_tree.Add(ps[i].x, 1);

    if (DEBUG) cout << "i: " << i << " ans: " << ans.Value() << endl;
  }
  cout << ans.Value() << endl;
}


Measured memory_bytes: 22060