Problem: We have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.

For a non-empty subset T of S, let f(T) be the number of points contained in the smallest rectangle, whose sides are parallel to the coordinate axes, that contains all the points in T. More formally, we define f(T) as follows:

* f(T) :=  (the number of integers i (1 \leq i \leq N) such that a \leq x_i \leq b and c \leq y_i \leq d, where a, b, c, and d are the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate of the points in T)



Find the sum of f(T) over all non-empty subset T of S. Since it can be enormous, print the sum modulo 998244353.

Constraints

* 1 \leq N \leq 2 \times 10^5
* -10^9 \leq x_i, y_i \leq 10^9
* x_i \neq x_j (i \neq j)
* y_i \neq y_j (i \neq j)
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
x_1 y_1
:
x_N y_N


Output

Print the sum of f(T) over all non-empty subset T of S, modulo 998244353.

Examples

Input

3
-1 3
2 1
3 -2


Output

13


Input

4
1 4
2 1
3 3
4 2


Output

34


Input

10
19 -11
-3 -12
5 3
3 -15
8 -14
-9 -20
10 -9
0 2
-7 17
6 -6


Output

7222

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
//const int MOD=1e9+7;
const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
template<typename T>
struct BIT{
  int n;
  vector<T> bit;
  //1-indexed
  BIT():n(-1){}
  BIT(int n_,T d):n(n_),bit(n_+1,d){}

  T sum(int i){
    T s=bit[0];
    for(int x=i;x>0;x-=(x&-x))
      s+=bit[x];
    return s;
  }
  void add(int i,T a){
    if(i==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      bit[x]+=a;
  }

  int lower_bound(int w){
    if(w<=0) return 0;
    int x=0,r=1;
    while(r<n) r<<=1;
    for(int k=r;k>0;k>>=1){
      if(x+k<=n&&bit[x+k]<w){
        w-=bit[x+k];
        x+=k;
      }
    }
    return x+1;
  }

  T sum0(int i){
    return sum(i+1);
  }
  void add0(int i,T a){
    add(i+1,a);
  }

  T query(int l,int r){
    return sum(r-1)-sum(l-1);
  }

  T query0(int l,int r){
    return sum(r)-sum(l);
  }
};
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
//main
signed main(){
  int N;cin>>N;
  std::vector<int> x(N),y(N);
  for(int i=0;i<N;i++)cin>>x[i]>>y[i];
  typedef pair<int,int> P;
  std::vector<P> v(N);
  for(int i=0;i<N;i++)v[i]=P(x[i],y[i]);
  sort(v.begin(),v.end());
  map<int,int> mx,my;//mxはデバッグする時にあると楽
  for(int i=0;i<N;i++)mx[x[i]]=my[y[i]]=0;
  int cnt=0;for(auto &p:my)p.second=++cnt;
  cnt=0;for(auto &p:mx)p.second=++cnt;
  BIT<int> b1(223456,0),b2(223456,0);
  std::vector<int> ru(N,0),rd(N,0),lu(N,0),ld(N,0);
  for(int i=0;i<N;i++){
    ld[i]=b1.sum(my[v[i].second]);
    lu[i]=i-ld[i];
    b1.add(my[v[i].second],1);
  }
  for(int i=N-1;i>=0;i--){
    rd[i]=b2.sum(my[v[i].second]);
    ru[i]=N-1-i-rd[i];
    b2.add(my[v[i].second],1);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    int a=pw(2,lu[i]),b=pw(2,ru[i]),c=pw(2,ld[i]),d=pw(2,rd[i]);
    ans+=(((b-1)*(c-1)%MOD)*((a*d)%MOD))%MOD;ans%=MOD;
    ans+=((a-1)*(d-1))%MOD*(b+c-1)%MOD;ans%=MOD;
  }
  ans+=pw(2,N-1)*N%MOD;ans%=MOD;
  cout<<ans<<endl;
}