#include <algorithm>
#include <iostream>
#include <tuple>
#include <vector>
using ll = int64_t;
class range {private: struct I{ll x;ll operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(ll n):i({0}),n({n}){}range(ll i,ll n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};
using namespace std;
constexpr ll mod = 998244353;

// Modulo calculus

// With Montgomery multiply
// Mod < 2^32, odd number
constexpr ll ceil_pow2(const ll x) {
  ll y = 1;
  while (y <= x) y *= 2;
  return y;
}

constexpr ll calc_np(const ll Mod, const ll R) {
  ll res = 0;
  ll t = 0;
  ll r = R;
  ll i = 1;
  while (r > 1) {
    if ((t % 2) == 0) {
      t += Mod;
      res += i;
    }
    t /= 2;
    r /= 2;
    i *= 2;
  }
  return res;
}

template <ll Mod>
class ModIntMR {
 public:
  explicit constexpr ModIntMR(const ll x) : data(reduction(x * R2)) {}
  ModIntMR<Mod>& operator=(const ModIntMR<Mod>& that) {
    data = that.data;
    return *this;
  }
  explicit operator ll() const { return reduction(data); }
  ModIntMR<Mod>& operator+=(const ModIntMR<Mod>& that) {
    data += that.data;
    if (data >= Mod) data -= Mod;
    return *this;
  }
  ModIntMR<Mod>& operator-=(const ModIntMR<Mod>& that) {
    data -= that.data;
    if (data < 0) data += Mod;
    return *this;
  }
  ModIntMR<Mod>& operator*=(const ModIntMR<Mod>& that) {
    data = reduction(data * that.data);
    return *this;
  }
  friend ModIntMR<Mod> operator+(ModIntMR<Mod> lhs, const ModIntMR<Mod>& rhs) {
    lhs += rhs;
    return lhs;
  }
  friend ModIntMR<Mod> operator-(ModIntMR<Mod> lhs, const ModIntMR<Mod>& rhs) {
    lhs -= rhs;
    return lhs;
  }
  friend ModIntMR<Mod> operator*(ModIntMR<Mod> lhs, const ModIntMR<Mod>& rhs) {
    lhs *= rhs;
    return lhs;
  }
  friend ModIntMR<Mod> operator^(ModIntMR<Mod> lhs, const ll rhs) {
    if (rhs == 0) return ModIntMR<Mod>(1);
    else if ((rhs % 2) == 1) return (lhs ^ (rhs-1)) * lhs;
    else {
      const auto half = lhs ^ (rhs / 2);
      return half * half;
    }
  }
  ModIntMR<Mod>& operator^=(const ll that) {
    data = (*this ^ that).data;
    return *this;
  }
 private:
  ll data;
  static constexpr ll R = ceil_pow2(Mod);
  static constexpr ll R2 = R*R%Mod;
  static constexpr ll Np = calc_np(Mod, R);
  static constexpr ll reduction(const ll T) {
    ll t = (T + T*Np%R*Mod)/R;
    return t >= Mod ? t - Mod : t;
  }
};

// Light version
using Data = int;
const int len = 1 << 18;

struct BIT {
  vector<Data> data;
  BIT() : data(len, 0) {}
  void update(int i, Data value) {
    for (; i < len; i |= i+1) data[i] += value;
  }
  Data query(int i) {
    Data s = 0;
    for (; i >= 0; i = (i&i+1)-1) s += data[i];
    return s;
  }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vector<ll> vy;
  vector<tuple<ll,ll>> vt;
  for (ll i : range(n)) {
    ll x, y;
    cin>>x>>y;
    vt.emplace_back(x, y);
    vy.push_back(y);
  }
  sort(begin(vt), end(vt));
  sort(begin(vy), end(vy));
  BIT bit;
  using modint = ModIntMR<mod>;
  modint sum(0);
  for (ll i : range(n)) {
    ll x, y;
    tie(x, y) = vt[i];
    ll under = lower_bound(begin(vy), end(vy), y) - begin(vy);
    ll a = bit.query(under);
    ll b = under - a;
    ll d = i - a;
    ll c = n-1 - a - b - d;
    sum += modint(2) ^ n;
    sum -= modint(2) ^ (a+b);
    sum -= modint(2) ^ (b+c);
    sum -= modint(2) ^ (c+d);
    sum -= modint(2) ^ (d+a);
    sum += modint(2) ^ a;
    sum += modint(2) ^ b;
    sum += modint(2) ^ c;
    sum += modint(2) ^ d;
    sum -= modint(1);
    bit.update(under, 1);
  }
  cout << static_cast<ll>(sum) << endl;
  return 0;
}



Measured memory_bytes: 8304