#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template<long long mod>
struct mint {
private:
    long long x;
public:
    mint(long long x = 0) :x((mod + x) % mod) {}
    mint(std::string &s) {
        long long z = 0;
        for (int i = 0; i < s.size(); i++) {
            z *= 10;
            z += s[i] - '0';
            z %= mod;
        }
        this->x = z;
    }
    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) {
        long long n = mod - 2;
        mint<mod> u = 1, b = a;
        while (n > 0) {
            if (n & 1) {
                u *= b;
            }
            b *= b;
            n >>= 1;
        }
        return *this *= u;
    }
    mint operator+(const mint &a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint &a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint &a) const {
        mint res(*this);
        return res /= a;
    }
    friend std::ostream& operator<<(std::ostream &os, const mint &n) {
        return os << n.x;
    }
    bool operator==(const mint &a) const {
        return this->x == a.x;
    }
};

//pow
template<typename T, typename U>
T pow(T k, U n, T unity = 1) {
    while (n > 0) {
        if (n & 1) {
            unity *= k;
        }
        k *= k;
        n >>= 1;
    }
    return unity;
}

// 0-indexedとして使う
// 実装は1-indexed
template< typename T >
struct BinaryIndexedTree {
    std::vector< T > data;

    BinaryIndexedTree(int sz) {
        data.assign(++sz, 0);
    }

    // [0,k]
    inline T sum(int k) {
        T ret = 0;
        for (++k; k > 0; k -= k & -k) ret += data[k];
        return (ret);
    }

    // [left,right]
    inline T sum(int left, int right) {
        return sum(right) - sum(left - 1);
    }

    // k番目にxを加算
    // 負の数も可
    inline void add(int k, T x) {
        for (++k; k < data.size(); k += k & -k) data[k] += x;
    }

    // k番目の値 0-indexed
    // 値 = index, 個数 = data[index]
    // 0がdata[0]個, 1がdata[1]個...
    int get(ll k) {
        ++k;
        int res = 0;
        int N = 1; while (N < (int)data.size()) N *= 2;
        for (int i = N / 2; i > 0; i /= 2) {
            if (res + i < (int)data.size() && data[res + i] < k) {
                k = k - data[res + i];
                res = res + i;
            }
        }
        return res + 1;
    }

    void print() {
        std::cout << "[ ";
        for (int i = 0; i < data.size() - 1; i++) {
            std::cout << sum(i, i);
            if (i < data.size() - 2) cout << ", ";
        }
        std::cout << " ]" << endl;
    }
};

// 転倒数 O(NlogN)
// verify : https://atcoder.jp/contests/chokudai_S001/tasks/chokudai_S001_j
// limit : 値の上限
// limit = -1 なら 圧縮あり
template<typename T>
vector<int> inversion(const vector<T> &v) {
    vector<int> res(v.size());
    int sz = v.size();
    int t = 0;
    map<T, int> mp;
    for (int i = 0; i < sz; i++) mp[v[i]] = -1;
    for (auto p : mp) mp[p.first] = t++;
    BinaryIndexedTree<ll> bit(t);
    for (int i = 0; i < sz; i++) {
        res[i] = bit.sum(mp[v[i]] - 1);
        bit.add(mp[v[i]], 1);
    }
    return res;
}

int main() {
    constexpr int MOD = 998244353;
    int n; cin >> n;
    vector<pair<int, int>> p(n);
    vector<int> p2(n), x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i].first >> p[i].second;
        x[i] = p[i].first;
        y[i] = p[i].second;
    }
    sort(p.begin(), p.end());
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    for (int i = 0; i < n; i++) {
        p2[i] = p[i].second;
    }
    mint<MOD> ans = 0;
    vector<int> dl = inversion(p2);
    vector<int> ul(n), ur(n), dr(n);
    for (int i = 0; i < n; i++) {
        ul[i] = n - 1 - dl[i] - (x.end() - upper_bound(x.begin(), x.end(), p[i].first));
        dr[i] = n - 1 - dl[i] - (y.end() - upper_bound(y.begin(), y.end(), p[i].second));
        ur[i] = n - 1 - ul[i] - dr[i] - dl[i];
    }
    for (int i = 0; i < n; i++) {
        ans += pow(mint<MOD>(2), n) - pow(mint<MOD>(2), ul[i] + ur[i]) - pow(mint<MOD>(2), ul[i] + dl[i]) - pow(mint<MOD>(2), dl[i] + dr[i]) - pow(mint<MOD>(2), dr[i] + ur[i]) + pow(mint<MOD>(2), ur[i]) + pow(mint<MOD>(2), ul[i]) + pow(mint<MOD>(2), dr[i]) + pow(mint<MOD>(2), dl[i]) - 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15872