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<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 998244353
#define mad(a,b) a=(a+b)%mod;
#define N 200010
typedef pair<ll,ll> P;
namespace seg{
  ll dat[2*N];
  void init(){
    for(int i=0;i<2*N;i++){
      dat[i]=0;
    }
  }
  void upd(ll p,ll x){
    p+=N;
    dat[p]=x;
    for(;p;p>>=1){
      dat[p/2]=dat[p]+dat[p^1];
    }
  }
  ll qry(ll l,ll r){
    l+=N,r+=N+1;
    ll res=0;
    for(ll a=l,b=r;a<b;a>>=1,b>>=1){
      if(a&1)res+=dat[a++];
      if(b&1)res+=dat[--b];
    }
    return res;
  };
};
ll po(ll x,ll y){
    ll res=1;
    for(;y;y>>=1){
	if(y&1)res=res*x%mod;
	x=x*x%mod;
    }
    return res;
}

ll n,x[N],y[N],xxx[N],yyy[N];
vector<ll> xx,yy;
unordered_map<ll,ll> compx,compy;
ll solve(){
  xx.clear(); yy.clear();
  compx.clear(); compy.clear();
  for(int i=0;i<n;i++){
    xx.push_back(x[i]);
    yy.push_back(y[i]);
  }
  sort(xx.begin(),xx.end());
  for(int i=0;i<xx.size();i++){
    compx[xx[i]]=i;
  }
  sort(yy.begin(),yy.end());
  for(int i=0;i<yy.size();i++){
    compy[yy[i]]=i;
  }
  for(int i=0;i<n;i++){
    xxx[i]=compx[x[i]];
    yyy[i]=compy[y[i]];
  }
  ll ans=0;
  seg::init();
  vector<P> v;
  for(int i=0;i<n;i++){
    v.push_back(make_pair(yyy[i],xxx[i]));
  }
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++){
    ll e=seg::qry(0,n-1); mad(ans,(po(2,e)-1));
    ll w=seg::qry(0,v[i].second); mad(ans,(po(2,w)-1)*-1);
    seg::upd(v[i].second,1);
  }
  return ans;
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>x[i]>>y[i];
  ll ans=solve();
  for(int i=0;i<n;i++)x[i]*=-1;
  mad(ans,solve());
  for(int i=0;i<n;i++)y[i]*=-1;
  mad(ans,solve());
  for(int i=0;i<n;i++)x[i]*=-1;
  mad(ans,solve());
  ans*=-1;
  mad(ans,(po(2,n)-1)*n);
  if(ans<0)ans+=mod;
  cout<<ans<<endl;
  return 0;
}