#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#define mod 998244353
#define maxn 200005

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
}
inline void putll(ll x){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}
int n;
struct Point{
  int x,y;
  bool operator < (const Point &b){
    return x < b.x;
  }
}p[maxn];
int bit[maxn];
void add(int pos,int x){
  for(int i = pos;i <= n;i += i & -i) bit[i] += x;
}
int qsum(int pos){
  int res = 0;
  for(int i = pos;i;i -= i & -i) res += bit[i];
  return res;
}
int left_down[maxn],left_up[maxn],right_down[maxn],right_up[maxn];
ll modpow(ll x,ll y){
  ll res = 1;
  while(y){
    if(y & 1) res = res * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return res;
}
int main(){
  n = getint();
  for(int i = 1;i <= n;i++){
    p[i].x = getint(), p[i].y = getint();
  }
  vector <int> xs;
  for(int i = 1;i <= n;i++) xs.push_back(p[i].x);
  sort(xs.begin(),xs.end());
  xs.erase(unique(xs.begin(),xs.end()),xs.end());
  for(int i = 1;i <= n;i++){
    p[i].x = lower_bound(xs.begin(),xs.end(),p[i].x) - xs.begin() + 1;
  }
  xs.clear();
  for(int i = 1;i <= n;i++) xs.push_back(p[i].y);
  sort(xs.begin(),xs.end());
  xs.erase(unique(xs.begin(),xs.end()),xs.end());
  for(int i = 1;i <= n;i++){
    p[i].y = lower_bound(xs.begin(),xs.end(),p[i].y) - xs.begin() + 1;
  }
  sort(p + 1,p + n + 1);
  
//  for(int i = 1;i <= n;i++){
//    cout << p[i].x << " " << p[i].y << endl;
//  }
//  system("pause");
  
  for(int i = 1;i <= n;i++){
    left_down[i] = qsum(p[i].y);
    left_up[i] = i - 1 - left_down[i];
    add(p[i].y,1);
  }
  memset(bit,0,sizeof(bit));
  for(int i = n;i >= 1;i--){
    right_down[i] = qsum(p[i].y);
    right_up[i] = n - i - right_down[i];
    add(p[i].y,1);
  }
  ll ans = 0;
  
//  for(int i = 1;i <= n;i++) cout << right_up[i] << " " << right_down[i] << endl;
//  system("pause");
  
  for(int i = 1;i <= n;i++){
    ans += modpow(2,n) - 1;
    ans -= modpow(2,n - p[i].y) + modpow(2,p[i].y - 1);
    ans -= modpow(2,p[i].x - 1) + modpow(2,n - p[i].x);
    ans += modpow(2,left_up[i]) + modpow(2,left_down[i]);
    ans += modpow(2,right_up[i]) + modpow(2,right_down[i]);
  }
  putll((ans % mod + mod) % mod);
  bufo.put('\n');
  bufo.flush();
  return 0;
}


Measured memory_bytes: 6772