#include <bits/stdc++.h>
#define fi first
#define se second
#define MOD 998244353
using namespace std;
using P = pair<long long, long long>;

// 1-indexed
template <class T>
struct BIT {
  vector<T> lst;
  int treesize;
  // constructor
  BIT(int newn = 0) {
    treesize = newn;
    lst.resize(treesize + 1);
    for(int i = 0; i <= treesize; ++i) lst[i] = 0;
  }
  // a_place += num
  bool add(int place, T num) {
    while(place <= treesize) {
      lst[place] += num;
      place += place & -place;
    }
    return 1;
  }
  // add wide ver.(add num between l and r)
  bool addw(int left, int right, T num) {
    while(left <= right && left >= 1 && right <= treesize)
      add(left++, num);
    return 1;
  }
  // sum between [1,place]
  T calcsum(int place) {
    T answer = 0;
    while(place > 0) {
      answer += lst[place];
      place -= place & -place;
    }
    return answer;
  }
  // sum [l,r]
  T calcsumw(int left, int right) {
    return calcsum(right) - calcsum(left - 1);
  }
};

long long n;
vector<P> v;
map<long long, long long> mp;
vector<long long> memo[2][2];

long long solve();
long long modpow(long long base, long long x) {
  long long ans = 1;
  while(x) {
    if(x & 1) (ans *= base) %= MOD;
    (base *= base) %= MOD;
    x >>= 1;
  }
  return ans;
}

int main() {
  cin >> n;
  v.resize(n);
  for(int i = 0; i < n; ++i) cin >> v[i].fi >> v[i].se;
  sort(v.begin(), v.end());
  cout << solve() << endl;
  return 0;
}

long long solve() {
  // compress
  vector<long long> lst;
  // x
  for(int i = 0; i < n; ++i) lst.push_back(v[i].fi);
  sort(lst.begin(), lst.end());
  lst.erase(unique(lst.begin(), lst.end()), lst.end());
  for(int i = 0; i < lst.size(); ++i) mp[lst[i]] = i;
  for(int i = 0; i < n; ++i) v[i].fi = mp[v[i].fi];
  // y
  lst.clear();
  for(int i = 0; i < n; ++i) lst.push_back(v[i].se);
  sort(lst.begin(), lst.end());
  lst.erase(unique(lst.begin(), lst.end()), lst.end());
  for(int i = 0; i < lst.size(); ++i) mp[lst[i]] = i;
  for(int i = 0; i < n; ++i) v[i].se = mp[v[i].se];
  // prepair
  for(int i = 0; i < 2; ++i)
    for(int j = 0; j < 2; ++j) memo[i][j].assign(n, 0);
  BIT<long long> bit(n);
  for(int i = 0; i < n; ++i) {
    memo[0][0][i] = bit.calcsum(v[i].se + 1);
    memo[0][1][i] = bit.calcsumw(v[i].se + 1, n);
    bit.add(v[i].se + 1, 1);
  }

  bit = BIT<long long>(n);
  for(int i = n - 1; i >= 0; --i) {
    memo[1][0][i] = bit.calcsum(v[i].se + 1);
    memo[1][1][i] = bit.calcsumw(v[i].se + 1, n);
    bit.add(v[i].se + 1, 1);
  }

  long long ans = 0;
  for(int i = 0; i < n; ++i) {
    // use v[i]
    (ans += modpow(2, n - 1)) %= MOD;
    // not use v[i]
    {
      long long sum = 0;
      // use memo[0][0]
      long long now = 0, bad = 0;
      now = (modpow(2, memo[0][0][i]) - 1 + MOD) % MOD;
      bad = (modpow(2, memo[1][0][i]) +
             modpow(2, memo[0][1][i]) - 1 + MOD) %
            MOD;
      (now *=
       (modpow(2, n - 1 - memo[0][0][i]) - bad + MOD) %
       MOD) %= MOD;
      sum = now;
      // not use memo[0][0]
      now = (modpow(2, memo[1][0][i]) - 1 + MOD) % MOD;
      (now *= (modpow(2, memo[0][1][i]) - 1 + MOD) % MOD) %=
          MOD;
      (now *= modpow(2, memo[1][1][i])) %= MOD;
      (sum += now) %= MOD;
      (ans += sum) %= MOD;
    }
  }
  return ans;
}

Measured memory_bytes: 39280