#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int mod=998244353,N=400005;
int add(int x,int y)
{
  x+=y;
  if(x>=mod) x-=mod;
  if(x<0) x+=mod;
  return x;
}
int mult(int x,int y)
{
  ll tmp=(ll)x*y;
  if(tmp>=mod) tmp%=mod;
  return tmp;
}
int x[N],y[N],ind[N],bit[N];
void update(int i)
{
  while(i<N)
    {
      bit[i]++;
      i+=(i&(-i));
    }
}
int query(int i)
{
  int ans=0;
  while(i)
    {
      ans+=bit[i];
      i-=(i&(-i));
    }
  return ans;
}
int n,left[N],up[N];
void reset()
{
  rep(i,1,n+1) ind[i]=i;
}
map<int,int> m;
int pw[N],ans[N];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  pw[0]=1;
  rep(i,1,N) pw[i]=mult(pw[i-1],2);
  rep(i,0,N) pw[i]=add(pw[i],-1);
  cin>>n;
  rep(i,1,n+1)
    cin>>x[i]>>y[i],m[x[i]],m[y[i]];
  int id=0;
  for(auto &it:m) it.se=++id;
  rep(i,1,n+1) x[i]=m[x[i]],y[i]=m[y[i]];
  reset();
  sort(ind+1,ind+n+1,[](int i,int j){return x[i]<x[j];});
  rep(i,1,n+1) ans[i]=pw[n];
  rep(i,1,n+1)
    {
      int j=i;
      while(j<=n && x[ind[i]]==x[ind[j]]) j++;
      //to the left
      rep(k,i,j) ans[ind[k]]=add(ans[ind[k]],-pw[i-1]);
      //to the right
      rep(k,i,j) ans[ind[k]]=add(ans[ind[k]],-pw[n-j+1]);
      i=j-1;
    }
  reset();
  sort(ind+1,ind+n+1,[](int i,int j){return y[i]<y[j];});
  rep(i,1,n+1)
    {
      int j=i;
      while(j<=n && y[ind[i]]==y[ind[j]]) j++;
      //to down
      rep(k,i,j) ans[ind[k]]=add(ans[ind[k]],-pw[i-1]);
      //to up
      rep(k,i,j) ans[ind[k]]=add(ans[ind[k]],-pw[n-j+1]);
      i=j-1;
    }
  reset();
  sort(ind+1,ind+n+1,[](int i,int j){return x[i]<x[j];});
  rep(i,1,n+1)
    {
      int j=i;
      while(j<=n && x[ind[i]]==x[ind[j]]) j++;
      rep(k,i,j)
	{
	  //bottom left
	  ans[ind[k]]=add(ans[ind[k]],pw[query(y[ind[k]]-1)]);
	  //up left
	  ans[ind[k]]=add(ans[ind[k]],pw[query(N-1)-query(y[ind[k]])]);
	}
      rep(k,i,j)
	update(y[ind[k]]);
      i=j-1;
    }
  rep(i,0,N) bit[i]=0;
  sort(ind+1,ind+n+1,[](int i,int j){return x[i]>x[j];});
  rep(i,1,n+1)
    {
      int j=i;
      while(j<=n && x[ind[i]]==x[ind[j]]) j++;
      rep(k,i,j)
	{
	  //bottom right
	  ans[ind[k]]=add(ans[ind[k]],pw[query(y[ind[k]]-1)]);
	  //up right
	  ans[ind[k]]=add(ans[ind[k]],pw[query(N-1)-query(y[ind[k]])]);
	}
      rep(k,i,j)
	update(y[ind[k]]);
      i=j-1;
    }
  int tot=0;
  rep(i,1,n+1) tot=add(tot,ans[i]);
  cout<<tot<<endl;
  return 0 ;
}


Measured memory_bytes: 28416