#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

//#define mod 1000000007 //1e9+7(prime number)
#define mod 998244353
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* Binary Indexed Tree(0-index) */

template <typename Type = int>
struct BIT{
  int bit_size;
  vector<Type> data;

  BIT(int n){
    bit_size = n;
    data.assign(n+2, 0);
  }

  //add x to kth value
  void add(int k, Type x){
    k++;
    while(k <= bit_size){
      data[k] += x;
      k += k & (-k);
    }
  }

  //sum of [0,k)
  Type query(int k){
    Type rec = 0;
    while(k > 0){
      rec += data[k];
      k -= k & (-k);
    }
    return rec;
  }

  //sum of [a, b)
  Type query(int a, int b){
    return query(b) - query(a);
  }
};

ll power(ll k, ll n, int M){
  ll res = 1;
  while(n > 0) {
    if (n & 1) res = res * k % M;
    k = k * k % M;
    n /= 2;
  }
  return res;
}


pair<int,int> p[SIZE];

int main() {
  int N;
  vector<int> vecx;
  map<int, int> dicx;

  scanf("%d", &N);

  for (int i=0; i<N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    p[i] = {y, x};
    vecx.push_back(x);
  }

  sort(vecx.begin(), vecx.end());
  vecx.erase(unique(vecx.begin(), vecx.end()), vecx.end());

  int W = vecx.size();

  for (int i=0; i<W; i++)
    dicx[vecx[i]] = i;


  for (int i=0; i<N; i++)
    p[i].second = dicx[p[i].second];

  sort(p, p+N);

  BIT<int> allp(W), u(W), d(W);

  for (int i=0; i<N; i++) {
    allp.add(p[i].second, 1);
    d.add(p[i].second, 1);
  }


  ll ans = 0;

  int t = 0, s = 0;
  for (int i=0; i<N; i++) {
    debug(p[i]);

    while(t < N && p[t].first == p[i].first) {
      d.add(p[t].second, -1);
      t++;
    }
    while(s < t && p[s].first != p[i].first) {
      u.add(p[s].second, 1);
      s++;
    }

    int x = p[s].second;

    ll sub = power(2, N, mod) - 1;

    int u_size = u.query(0, W);
    int d_size = d.query(0, W);
    int l_size = allp.query(0, x);
    int r_size = allp.query(x+1, W);
    int ul_size = u.query(0, x);
    int ur_size = u.query(x+1, W);
    int dl_size = d.query(0, x);
    int dr_size = d.query(x+1, W);

    sub -= power(2, u_size, mod) - 1;
    sub -= power(2, d_size, mod) - 1;
    sub -= power(2, l_size, mod) - 1;
    sub -= power(2, r_size, mod) - 1;
    sub += power(2, ul_size, mod) - 1;
    sub += power(2, ur_size, mod) - 1;
    sub += power(2, dl_size, mod) - 1;
    sub += power(2, dr_size, mod) - 1;

    sub = mod + sub % mod;

    ans = (ans + sub) % mod;
  }

  ans = ans % mod;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 14324