/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());
constexpr ll mod17 = 1e9+7;
constexpr ll mod19 = 1e9+9;
constexpr ll mod9 = 998244353;

// Mod int library
unordered_map<ll, ll> minvmap;
ll minv(ll a, ll m) {
  auto k = a; auto p = minvmap[a]; if (p != 0) return p;
  ll b = m, u = 1, v = 0;
  while (b) { ll t = a/b; swap(a -= t*b, b); swap(u -= t*v, v); }
  p = (u%m+m)%m; minvmap[k] = p; return p;
}

template<ll mod=mod17>
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  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){ (x*=minv(a.x, mod))%=mod; return *this; }
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  mint operator/(const mint& a)const{ return mint(*this) /= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};

template<ll mod=mod17>
istream& operator>>(istream&i,mint<mod>&a){i>>a.x;return i;}

template<ll mod=mod17>
ostream& operator<<(ostream&o,const mint<mod>&a){o<<a.x;return o;}

template<typename T>
T mod_pow(T a, ll x) {
  T res = 1;
  while(x > 0) {
    if (x & 1) res *= a;
    a *= a; x >>= 1;
  }
  return res;
}
template<ll mod=mod17>
class combination {
    // factorial
    public: vector<mint<mod>> fact;
    public: vector<mint<mod>> inv;

    combination(int n) {
      fact.resize(n + 1);
      inv.resize(n + 1);
      fact[0] = 1;
      for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i;
      inv[n] = mint<mod>(1) / fact[n];
      for (int i = n - 1; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1);
    }

    // nCr
    public: mint<mod> get(int n, int r) {
      if (n < r || n < 0 || r < 0) return 0;
      return fact[n]*inv[r]*inv[n-r];
    }
    // nPr
    public: mint<mod> p(int n, int r) {
      if (n < r || n < 0) return 0;
      return fact[n]*inv[n-r];
    }
};

class FEnclosedPoints {
public:

    struct SegTree {
        int N;
        vector<ll> dat;

        void init(int n) {
          N = 1;
          while(N < n) N *= 2;
          dat.resize(2*N-1, 0);
        }

        void build(vector<ll>& a) {
          int n = a.size();
          init(n);
          for(int i=0; i<n; i++) dat[i+N-1] = a[i];
          for(int i=N-2; i>=0; i--) dat[i] = dat[i*2+1]+dat[i*2+2];
        }

        // update k-th element
        void update(int k, long long a) {
          k += N-1;
          dat[k] = a;
          while(k > 0) {
            k = (k-1)/2;
            dat[k] = dat[k*2+1] + dat[k*2+2];
          }
        }

        // add k-th element by a
        void add(int k, long long a) {
          k += N-1;
          dat[k] += a;
          while(k > 0) {
            k = (k-1)/2;
            dat[k] = dat[k*2+1] + dat[k*2+2];
          }
        }

        // return sum[a, b)
        ll query(int a, int b) {
          return query(a, b, 0, 0, N);
        }
        ll query(int a, int b, int k, int l, int r) {
          if (r <= a || b <= l) return 0;
          if (a <= l && r <= b) return dat[k];
          auto m = (l+r)/2;
          return query(a, b, k*2+1, l, m) + query(a, b, k*2+2, m, r);
        }
    };

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<P> vec(n);
      set<int> stx, sty;
      rep(i, n) {
        cin >> vec[i].first >> vec[i].second;
        stx.insert(vec[i].first);
        sty.insert(vec[i].second);
      }
      unordered_map<int, int> mpx, mpy;
      int idx = 0;
      for(auto e: stx) {
        mpx[e] = idx;
        idx++;
      }
      idx = 0;
      for(auto e: sty) {
        mpy[e] = idx;
        idx++;
      }
      rep(i, n) {
        vec[i].first = mpx[vec[i].first];
        vec[i].second = mpy[vec[i].second];
      }
      sort(all(vec));
      mint<mod9> ans1 = 0;
      auto comb = combination<mod9>(n);
      for(int i=1; i<=n; i++) {
        ans1 += comb.get(n, i)*i;
      }
      mint<mod9> ans2 = 0;
      mint<mod9> two = 2;

      SegTree left, right;
      left.init(n);
      right.init(n);
      rep(i, n) {
        right.add(i, 1);
      }

      rep(i, n) {
        auto x = vec[i].first;
        auto y = vec[i].second;
        debug(x, y);
        mint<mod9> tmp1 = 0;
        right.add(y, -1);

        int a1 = left.query(0, y);
        int a2 = left.query(y+1, n);

        int a3 = right.query(0, y);
        int a4 = right.query(y+1, n);

        auto m1 = mod_pow(two, a1);
        auto m2 = mod_pow(two, a2);
        auto m3 = mod_pow(two, a3);
        auto m4 = mod_pow(two, a4);
        debug(a1, a2, a3, a4);
        debug(m1.x, m2.x, m3.x, m4.x);
        tmp1 += (m1-1)*(m4-1)*m2*m3;
        tmp1 += (m2-1)*(m3-1)*m1*m4;
        tmp1 -= (m1-1)*(m2-1)*(m3-1)*(m4-1);
        ans2 += tmp1;

        left.add(y, 1);
      }
      debug(ans1.x, ans2.x);
      cout << ans1+ans2 << endl;
    }
};

signed main() {
  FEnclosedPoints solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 49992