//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;
 
//const long long INF = 1LL << 55;
 
#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//mint
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
#define MAX_N 400010

class BIT {
	// Implementation of a Binary Indexed Tree (Fennwick Tree)
public:
	/*BIT(std::vector<int> list) {
		// Initialize BIT with list in O(n*log(n))
		m_array = std::vector<int>(list.size() + 1, 0);
		for (int idx = 0; idx < list.size(); idx++) {
			update(idx, list[idx]);
		}
	}*/

	BIT(std::vector<int> list) {
		// Initialize BIT with list in O(n)
		m_array = std::vector<int>(list.size() + 1, 0);
		for (int idx = 0; idx < list.size(); idx++) {
			m_array[idx + 1] = list[idx];
		}

		for (int idx = 1; idx < m_array.size(); idx++) {
			int idx2 = idx + (idx & -idx);
			if (idx2 < m_array.size()) {
				m_array[idx2] += m_array[idx];
			}
		}
	}

	int prefix_query(int idx) const {
		// Computes prefix sum of up to the element at index idx
		int result = 0;
		for (++idx; idx > 0; idx -= idx & -idx) {
			result += m_array[idx];
		}
		return result;
	}

	int range_query(int from_idx, int to_idx) const {
		// Computes the range sum between two indices (both inclusive)
        if (from_idx == 0)
            return prefix_query(to_idx);
        else
            return prefix_query(to_idx) - prefix_query(from_idx - 1);
	}

	void update(int idx, int add) {
		// Add a value to the element at index idx
		for (++idx; idx < m_array.size(); idx += idx & -idx) {
			m_array[idx] += add;
		}
	}

private:
	std::vector<int> m_array;
};
ll n;
vector<int> x,y;
int pts[200010][2][2];
int main(void){
   cin >> n;
   rep(i,n){
      int px,py;cin >> px >> py;
      x.pb(px);
      y.pb(py);
   }
   
   vector<int> sorted_x,sorted_y;
   rep(i,n){
      sorted_x.pb(x[i]);
      sorted_y.pb(y[i]);
   }
   sort(all(sorted_x));
   sort(all(sorted_y));
   
   rep(i,n){
      x[i] = 1 + lower_bound(all(sorted_x),x[i]) - sorted_x.begin();
      y[i] = 1 + lower_bound(all(sorted_y),y[i]) - sorted_y.begin();
   }
   
   vector<pair<int,int>> pos(n);
   rep(i,n){
      pos[i] = mp(x[i],y[i]);
   }
   sort(all(pos));
   // vector<int> pos_y(n);rep(i,n) pos_y[i] = pos[i].second;  
   BIT bit(vector<int>(n+2,0));
   rep(i,n){
      pts[i][0][0] = bit.prefix_query(pos[i].second);
      pts[i][1][0] = i - pts[i][0][0];
      bit.update(pos[i].second,1);
   }
   
   BIT bit2(vector<int>(n+2,0));
   for(int i = n - 1;i >= 0;i--){
      pts[i][0][1] = bit2.prefix_query(pos[i].second);
      pts[i][1][1] = (n - 1 - i) - pts[i][0][1];
      bit2.update(pos[i].second,1);
   }
   
   mint ans = 0;
   rep(i,n){
      mint A = (mint)qp(2,pts[i][0][0],998244353);
      mint B = (mint)qp(2,pts[i][0][1],998244353);
      mint C = (mint)qp(2,pts[i][1][0],998244353);
      mint D = (mint)qp(2,pts[i][1][1],998244353);
      ans += ((A-1)*(D-1)*B*C + A*D*(B-1)*(C-1) - (A-1)*(B-1)*(C-1)*(D-1));
      mint E = (mint)qp(2,n-1,998244353);
      ans += E;
   }
   cout << ans.x << endl;
}

Measured memory_bytes: 12420