#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

template <std::uint_fast64_t mod>
class ModInt {
    using u64 = std::uint_fast64_t;

   public:
    u64 x;
    ModInt(const ll x = 0) : x(x < 0 ? (mod - (-x % mod)) % mod : x % mod) {}

    ModInt operator+(const ModInt r) { return ModInt(*this) += r; }
    ModInt operator*(const ModInt r) { return ModInt(*this) *= r; }
    ModInt operator-(const ModInt r) { return ModInt(*this) -= r; }
    ModInt operator/(const ModInt r) { return ModInt(*this) /= r; }
    ModInt operator-() { return ModInt(mod - x); }

    ModInt &operator+=(const ModInt r) {
        x += r.x;
        if (x >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt r) {
        if (x < r.x) x += mod;
        x -= r.x;
        return *this;
    }
    ModInt &operator*=(const ModInt r) {
        x *= r.x;
        if (x >= mod) x %= mod;
        return *this;
    }
    ModInt &operator/=(ModInt r) {
        if (!(x % r.x)) {
            x /= r.x;
            return *this;
        }
        u64 p = mod - 2;
        while (p > 0) {
            if (p & 1) *this *= r;
            r *= r;
            p >>= 1;
        }
        return *this;
    }
    ModInt &operator++(int) { return (*this) += 1; }
    ModInt &operator++() { return (*this) += 1; }
    ModInt &operator--(int) { return (*this) -= 1; }
    ModInt &operator--() { return (*this) -= 1; }

    bool operator<(const ModInt r) { return x < r.x; }
    bool operator>(const ModInt r) { return x > r.x; }
    bool operator<=(const ModInt r) { return x <= r.x; }
    bool operator>=(const ModInt r) { return x >= r.x; }
    bool operator==(const ModInt r) { return x == r.x; }
    bool operator!=(const ModInt r) { return x != r.x; }

    ModInt inv() { return (ModInt)1 / (*this); }
    int get_mod() { return mod; }

    friend std::istream &operator>>(std::istream &in, ModInt &m) {
        ll a;
        in >> a;
        if (a < 0) a = mod - (-a % mod);
        if (a >= mod) a %= mod;
        m.x = a;
        return in;
    }
    friend std::ostream &operator<<(std::ostream &out, const ModInt &m) {
        out << m.x;
        return out;
    }
};
constexpr std::uint_fast64_t mod = 998244353;
using mint = ModInt<mod>;

template <typename T>
class BIT {
    using u32 = uint_fast32_t;
    // bit : 1-indexed,各要素の値を持つ
    vector<T> bit;
    u32 n;

   public:
    BIT(u32 N) {
        n = N;
        bit.assign(N + 1, 0);
    }

    // i番目の値にxを加える
    void add(u32 i, T x) {
        while (i <= n) {
            bit[i] += x;
            // i&-i : iの最右1bit
            i += i & -i;
        }
    }

    // a1～aiの総和を返す
    T sum(u32 i) {
        T s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    // ai～ajの総和を返す
    T range_sum(u32 i, u32 j) { return sum(j) - sum(i - 1); }
};

template <typename T, typename U>
T pow(T x, U n, T e = 1) {
    T res = e;
    while (n > 0) {
        if (n & 1) res *= x;
        x *= x;
        n >>= 1;
    }
    return res;
}

struct Point {
    int x, y;
};

int main() {
    int N;
    cin >> N;
    vector<Point> v(N);
    unordered_map<int, int> mp;
    for (int i = 0; i < N; i++) {
        cin >> v[i].x >> v[i].y;
    }
    sort(v.begin(), v.end(), [](Point &l, Point &r) { return l.y < r.y; });
    for (int i = 0; i < N; i++) mp[v[i].y] = i + 1;
    sort(v.begin(), v.end(), [](Point &l, Point &r) { return l.x < r.x; });

    BIT<int> ltree(N), rtree(N);
    for (int i = 0; i < N; i++) rtree.add(i + 1, 1);

    mint ans = 0;
    auto p2 = [](uint_fast32_t n) { return pow<mint, uint_fast32_t>(2, n); };
    auto g = [&](uint_fast32_t n) { return (n > 0 ? p2(n) - 1 : 0); };
    for (int i = 0; i < N; i++) {
        int s1, s2, s3, s4;
        int j = mp[v[i].y];

        ltree.add(j, 1);
        rtree.add(j, -1);

        s1 = j < N ? ltree.range_sum(j + 1, N) : 0;
        s2 = ltree.sum(j - 1);
        s3 = j < N ? rtree.range_sum(j + 1, N) : 0;
        s4 = rtree.sum(j - 1);
        ans += g(s2) * g(s3) * p2(s1 + s4) + g(s1) * g(s4) * p2(s2 + s3) -
               g(s1) * g(s2) * g(s3) * g(s4) + p2(N - 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11592