#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = 998244353;

typedef pair<int,int> Pr;
struct P {
  int x, y, id;
};

const int MAX_N = 212345;
P q[MAX_N];

ll two[MAX_N];

vector<int> normalize(const vector<int> v) {
  const int N = v.size();
  vector<int> res(N);
  vector<pair<int,int> > t(N);
  REP(i, N) t[i] = { v[i], i };
  sort(ALL(t));
  int r = 0;
  REP(i, N) {
    r += (i > 0 && t[i - 1].first != t[i].first);
    res[t[i].second] = r;
  }
  return res;
}

struct BIT {
  int n;
  vector<ll> tree;
  BIT(int n):n(n),tree(n+1) {}
  void fill(ll val) {
    REP(i, n+1) tree[i] = (i&-i) * val;
  }
  void add(int idx, ll val) {
    for (int x=idx+1; x<=n; x+=x&-x) tree[x] += val;
  }
  // sum[0, idx]
  ll range(int idx) {
    ll sum=0;
    for (int x=idx+1; x>0; x-=x&-x) sum += tree[x];
    return sum;
  }
  // sum[a, b]
  ll range(int a, int b) {
    return range(b) - range(a - 1);
  }
};

int main2() {
  int N = nextInt();
  REP(i, N) {
    q[i].x = nextInt();
    q[i].y = nextInt();
    q[i].id = i;
  }
  vector<ll> left(N), right(N), upper(N), bottom(N);
  vector<ll> upper_left(N), upper_right(N), bottom_left(N), bottom_right(N);

  {
    vector<int> a(N);
    REP(i, N) a[i] = q[i].x;
    a = normalize(a);
    REP(i, N) q[i].x = a[i];

    BIT bit(N+10);
    REP(i, N) bit.add(q[i].x, 1);
    REP(i, N) left[i] = bit.range(q[i].x - 1);
    REP(i, N) right[i] = N - bit.range(q[i].x);
  }
  {
    vector<int> a(N);
    REP(i, N) a[i] = q[i].y;
    a = normalize(a);
    REP(i, N) q[i].y = a[i];

    BIT bit(N+10);
    REP(i, N) bit.add(q[i].y, 1);
    REP(i, N) bottom[i] = bit.range(q[i].y - 1);
    REP(i, N) upper[i] = N - bit.range(q[i].y);
  }

  {
    sort(q, q+N, [](const P&a, const P&b){ return a.x < b.x; });
    BIT bit(N+10);
    int i = 0, j = 0;
    for (int px = 0; px < N; px++) {
      while (i < N && q[i].x == px) {
        bottom_left[q[i].id] = bit.range(q[i].y - 1);
        upper_left[q[i].id] = j - bit.range(q[i].y);
        i++;
      }
      while (j < N && q[j].x == px) {
        bit.add(q[j].y, 1);
        j++;
      }
    }
  }

  {
    sort(q, q+N, [](const P&a, const P&b){ return a.x > b.x; });
    BIT bit(N+10);
    int i = 0, j = 0;
    for (int px = N; px >= 0; px--) {
      while (i < N && q[i].x == px) {
        bottom_right[q[i].id] = bit.range(q[i].y - 1);
        upper_right[q[i].id] = j - bit.range(q[i].y);
        i++;
      }
      while (j < N && q[j].x == px) {
        bit.add(q[j].y, 1);
        j++;
      }
    }
  }

  ll ans = N * (two[N]-1) % MOD;
  REP(i, N) {
    ll s = 0;
    s += two[bottom[i]];
    s += two[left[i]];
    s += two[upper[i]];
    s += two[right[i]];
    s -= two[bottom_left[i]];
    s -= two[bottom_right[i]];
    s -= two[upper_left[i]];
    s -= two[upper_right[i]];
    s = (s % MOD + MOD) % MOD;
    ans = (((ans - s) % MOD) + MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}

int main() {

  two[0] = 1;
  for (int i = 1; i < MAX_N; i++) two[i] = two[i-1] * 2 % MOD;

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 20788