#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

const ll mod =  998244353;
using modint = ModInt< mod >;

template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }
};

int N;
vector<pii> P;
void input(){
    fast_io();
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int x,y; cin >> x >> y;
        P.emplace_back(x,y);
    }
    
}

int solve(){
    sort(P.begin(),P.end(),[](pii a, pii b){return a.first < b.first;});
    for (int i = 0; i < N; i++) P[i].first = i;

    sort(P.begin(),P.end(),[](pii a, pii b){return a.second < b.second;});
    for (int i = 0; i < N; i++) P[i].second = i;
    
    map<pii,int> I;
    for (int i = 0; i < N; i++) I[P[i]] = i;

    SegmentTree<int> seg_LD(N+1, [](int a, int b){return a+b;}, 0);
    SegmentTree<int> seg_LU(N+1, [](int a, int b){return a+b;}, 0);
    SegmentTree<int> seg_RD(N+1, [](int a, int b){return a+b;}, 0);
    SegmentTree<int> seg_RU(N+1, [](int a, int b){return a+b;}, 0);
    vector<int> dp_LD(N,0);
    vector<int> dp_LU(N,0);
    vector<int> dp_RD(N,0);
    vector<int> dp_RU(N,0);
    // sort(P.begin(),P.end(),[](pii a, pii b){return a.second < b.second;});
    for (int i = 0; i < N; i++)
    {
        dp_RD[I[P[i]]] = seg_RD.query(P[i].first+1,N);
        dp_LD[I[P[i]]] = seg_LD.query(0,P[i].first);
        seg_RD.update(P[i].first, 1);
        seg_LD.update(P[i].first, 1);
    }
    // indexの情報が変わってる・・・
    sort(P.begin(),P.end(),[](pii a, pii b){return a.second > b.second;});
    for (int i = 0; i < N; i++)
    {
        dp_RU[I[P[i]]] = seg_RU.query(P[i].first+1,N);
        dp_LU[I[P[i]]] = seg_LU.query(0,P[i].first);
        seg_RU.update(P[i].first,1);
        seg_LU.update(P[i].first,1);
    }
    modint ans = 0;

    for (int i = 0; i < N; i++) {
        ans += modint(2).pow(N-1);
        ans += (modint(2).pow(dp_LD[i])-1)*(modint(2).pow(dp_RU[i])-1)*modint(2).pow(dp_LU[i])*modint(2).pow(dp_RD[i]);
        ans += (modint(2).pow(dp_LU[i])-1)*(modint(2).pow(dp_RD[i])-1)*modint(2).pow(dp_LD[i])*modint(2).pow(dp_RU[i]);
        ans -= (modint(2).pow(dp_LU[i])-1)*(modint(2).pow(dp_RD[i])-1)*(modint(2).pow(dp_LD[i])-1)*(modint(2).pow(dp_RU[i])-1);
        }
    cout << ans << endl;
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 25712