#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<map>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

template<typename T, long long MOD_VALUE>
class ModInt {
    static constexpr long long MOD = MOD_VALUE;
    private:
        T value_;
    public:
        ModInt() {}
        ModInt(const T& value) {if (value >= 0) {value_ = value % MOD;} else {T k = (MOD - 1 - value) / MOD; value_ = (value + k * MOD) % MOD;}}
        ModInt& operator+=(const ModInt& x)  {value_ += x.value_; if (value_ >= MOD) value_ -= MOD; return *this;}
        friend ModInt& operator+=(const T& x, const ModInt& y) {ModInt res(x); res.value_ += x.value_; if (res.value_ >= MOD) res.value_ -= MOD; return res;}
        ModInt& operator-=(const ModInt& x) {if (value_ < x.value_) value_ += MOD; value_ -= x.value_; return *this;}
        friend ModInt& operator-=(const T& x, const ModInt& y) {ModInt res(x); if (res.value_ < y.value_) res.value_ += MOD; res.value_ -= y.value_; return res;}
        ModInt& operator*=(const ModInt& x) {value_ = (value_ * x.value_) % MOD; return *this;}
        friend ModInt& operator*=(const T& x, const ModInt& y) {ModInt res(x); res.value_ = (res.value_ * y.value_) % MOD; return res;}
        const ModInt operator+(const ModInt& x) const {return ModInt(*this) += x;}
        friend const ModInt operator+(const T& x, const ModInt& y) {return ModInt(x) += y;}
        const ModInt operator-(const ModInt& x) const {return ModInt(*this) -= x;}
        friend const ModInt operator-(const T& x, const ModInt& y) {return ModInt(x) -= y;}
        const ModInt operator*(const ModInt& x) const {return ModInt(*this) *= x;}
        friend const ModInt operator*(const T& x, const ModInt& y) {return ModInt(x) *= y;}
        static ModInt modpow(ModInt x, long long y) {ModInt z = 1; while (y > 0) {if (y & 1) {z *= x;}x *= x; y /= 2;} return z;}
        ModInt& operator/=(const ModInt& x) {return *this *= modpow(x, MOD - 2);}
        const ModInt operator/(const ModInt& x) const {return ModInt(*this) /= x;}
        friend const ModInt operator/(const T& x, const ModInt& y) {return ModInt(x) /= y;}
        ModInt operator++(int) {ModInt tmp(*this); value_ = (value_ + 1 == MOD ? 0 : value_ + 1); return tmp;}
        ModInt operator--(int) {ModInt tmp(*this); value_ = (value_ - 1 < 0 ? MOD - 1 : value_ - 1); return tmp;}
        friend istream& operator>>(istream& stream, ModInt& x) {stream >> x.value_; x.value_ %= MOD; return stream;}
        friend ostream& operator<<(ostream& stream, const ModInt& x) {stream << x.value_; return stream;}
};

using mint = ModInt<ll, 998244353>;

template <typename T>
class SegTree {
    private:
        size_t node_size_;
        vector<T> node_;
        T identity_;                     // ex) INF, 0, etc...
        function<T(T, T)> operation_;    // ex) min, max, sum, etc...
        function<T(T, T)> update_;       // ex) add, change, etc..
    public:
        SegTree(size_t node_size, T identity, function<T(T, T)> operation, function<T(T, T)> update):
        identity_(identity), operation_(operation), update_(update) {
            node_size_ = 1;
            while (node_size_ < node_size) node_size_ *= 2;
            node_ = vector<T>(2 * node_size_ - 1, identity);
        }
        void change(int idx, T new_value) {
            int node_idx = idx + node_size_ - 1;
            node_[node_idx] = update_(node_[node_idx], new_value);
            while (node_idx > 0) {
                node_idx = (node_idx - 1) / 2;
                node_[node_idx] = operation_(node_[node_idx * 2 + 1], node_[node_idx * 2 + 2]);
            }
        }
        T _query(int left, int right, int node_idx, int node_left, int node_right) {
            if (node_right <= left || right <= node_left) {
                return identity_;
            }
            if (left <= node_left && node_right <= right) {
                return node_[node_idx];
            }
            else {
                T left_value = _query(left, right, node_idx * 2 + 1, node_left, (node_left + node_right) / 2);
                T right_value = _query(left, right, node_idx * 2 + 2, (node_left + node_right) / 2, node_right);
                return operation_(left_value, right_value);
            }
        }
        T query(int left, int right) {
            return _query(left, right, 0, 0, node_size_);
        }
        T operator[](int idx) {
            return node_[idx + node_size_ - 1];
        }
};

using P = pair<int, int>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    rep(i, 0, N) {
        cin >> X[i] >> Y[i];
    }
    map<int, int> pos_map;
    vector<int> YY(Y);
    sort(all(YY));
    rep(i, 0, N) {
        pos_map[YY[i]] = i;
    }
    vector<P> pos;
    rep(i, 0, N) {
        pos.emplace_back(X[i], Y[i]);
    }
    sort(all(pos));
    SegTree<ll> left_seg(N, 0, [](ll a, ll b) {return a + b;}, [](ll a, ll b) {return a + b;});
    SegTree<ll> right_seg(N, 0, [](ll a, ll b) {return a + b;}, [](ll a, ll b) {return a + b;});
    rep(i, 0, N) {
        right_seg.change(pos_map[Y[i]], 1);
    }
    mint ans = 0;
    rep(i, 0, N) {
        right_seg.change(pos_map[pos[i].second], -1);
        ans += mint::modpow(2, N - 1);
        ll area1 = left_seg.query(pos_map[pos[i].second] + 1, N);
        ll area2 = right_seg.query(pos_map[pos[i].second] + 1, N);
        ll area3 = right_seg.query(0, pos_map[pos[i].second]);
        ll area4 = left_seg.query(0, pos_map[pos[i].second]);
        ans += (mint::modpow(2, area1) - 1) * (mint::modpow(2, area3) - 1) * mint::modpow(2, area2) * mint::modpow(2, area4);
        ans += (mint::modpow(2, area2) - 1) * (mint::modpow(2, area4) - 1) * mint::modpow(2, area1) * mint::modpow(2, area3);
        ans -= (mint::modpow(2, area1) - 1) * (mint::modpow(2, area2) - 1) * (mint::modpow(2, area3) - 1) * (mint::modpow(2, area4) - 1);
        left_seg.change(pos_map[pos[i].second], 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 21872