#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

// modint (MOD で割ったあまりを扱う構造体)

template<int MOD> struct Fp {
    long long val;

    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }

    constexpr int getmod() {
        return MOD;
    }

    constexpr Fp operator-() const noexcept {
        return val ? MOD - val : 0;
    }

    constexpr Fp operator+(const Fp& r) const noexcept {
        return Fp(*this) += r;
    }

    constexpr Fp operator-(const Fp& r) const noexcept {
        return Fp(*this) -= r;
    }

    constexpr Fp operator*(const Fp& r) const noexcept {
        return Fp(*this) *= r;
    }

    constexpr Fp operator/(const Fp& r) const noexcept {
        return Fp(*this) /= r;
    }

    constexpr Fp& operator+=(const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }

    constexpr Fp& operator-=(const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }

    constexpr Fp& operator*=(const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }

    constexpr Fp& operator/=(const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }

    constexpr bool operator==(const Fp& r) const noexcept {
        return this->val == r.val;
    }

    constexpr bool operator!=(const Fp& r) const noexcept {
        return this->val != r.val;
    }

    friend constexpr ostream& operator<<(ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }

    friend constexpr istream& operator>>(istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }

};

Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
}

using mint = Fp<MOD>;

const ll MAX_N = 200010;
ll fact[MAX_N];
ll fact_inv[MAX_N];

class SegmentTree {
public:
    int N; //要素数
    vector<ll> dat;

    SegmentTree(int n_) {
        N = 1;
        while (N < n_) N *= 2;
        dat.assign(2 * N - 1, 0);
    }

    void update(int k, int a) { //k番目(0-indexed)をaに変更
        k += N - 1; //一番下
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2; //1つ上がる
            //更新
            dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2]; //
        }
    }

    //[a, b)の値（最小値/和/etc.）を求める
    //kは節点の番号、l, rはその節点が[l,r)に対応づいていることを表す
    //外からはquery(a, b)と呼ぶ

    int query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;
        if (r <= a || b <= l) return 0;
        //[a, b)が[l,r)を完全に含む
        if (a <= l && r <= b) return dat[k];
        else {
            int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return vl + vr; //
        }
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    int n;
    cin >> n;
    ll x[200010], y[200010];

    vector<pll> vx, vy;

    rep(i, n) {
        cin >> x[i] >> y[i];
        vx.push_back(MP(x[i], i));
        vy.push_back(MP(y[i], i));
    }

    sort(all(vx));
    sort(all(vy));

    rep(i, n) {
        x[vx[i].second] = i;
        y[vy[i].second] = i;
    }

    pll dot[200010];
    rep(i, n) dot[i].first = x[i], dot[i].second = y[i];
    sort(dot, dot + n);

    SegmentTree sg_front(n), sg_back(n);
    ll LU[200010], LD[200010], RU[200010], RD[200010];

    rep(i, n) {
        LD[i] = sg_front.query(0, dot[i].second);
        LU[i] = sg_front.query(dot[i].second, n);
        sg_front.update(dot[i].second, 1);
    }

    for (int i = n - 1; i >= 0; --i) {
        RD[i] = sg_back.query(0, dot[i].second);
        RU[i] = sg_back.query(dot[i].second, n);
        sg_back.update(dot[i].second, 1);
    }

    mint sum = 0;

    rep(i, n) {
        sum += (modpow(2, LU[i]) - 1) * (modpow(2, RD[i]) - 1) * modpow(2, LD[i] + RU[i]);
        sum += (modpow(2, LD[i]) - 1) * (modpow(2, RU[i]) - 1) * modpow(2, LU[i] + RD[i]);
        sum -= (modpow(2, LU[i]) - 1) * (modpow(2, RD[i]) - 1) * (modpow(2, LD[i]) - 1) * (modpow(2, RU[i]) - 1);
        sum += modpow(2, n - 1);
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 29148