#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class FenwickTree {
    public:
        FenwickTree(int n) : N(n), data(n, 0) {

        }

        void reset() {
            fill(data.begin(), data.end(), 0);
        }

        void put(int x, int v) {
            for (; x < N; x |= x + 1) {
                data[x] += v;
            }
        }

        int get(int x) {
            int res = 0;
            for (; x >= 0; x = (x & (x + 1)) - 1) {
                res += data[x];
            }
            return res;
        }

    private:
        int N;
        vector<int> data;
};


class Solution {
public:
    long long solve(vector<pair<int,int>>& points) {
        sort(points.begin(), points.end());
        int n = points.size();
        init(n + 123);

        vector<vector<int>> cnts(n, vector<int>(4, 0));

        vector<int> Y;
        for (auto& p : points) {
            Y.push_back(p.second);
        }
        sort(Y.begin(), Y.end());
        for (auto& p : points) {
            auto idx = lower_bound(Y.begin(), Y.end(), p.second) - Y.begin();
            p.second = idx;
        }

        FenwickTree ft(n + 12);

        for (int i = 0; i < n; ++i) {
            int y = points[i].second;

            cnts[i][0] = ft.get(y);
            cnts[i][1] = i - cnts[i][0];

            ft.put(y, 1);
        }

        ft.reset();
        for (int i = n - 1; i >= 0; --i) {
            int y = points[i].second;
            cnts[i][2] = ft.get(y);
            cnts[i][3] = (n - 1 - i) - cnts[i][2];

            ft.put(y, 1);
        }


        long long res = 0;
        res += n * powM(2, n - 1) % MOD;


        vector<int> M;
        vector<int> req;
        req.push_back(1 << 0 | 1 << 3);
        req.push_back(1 << 1 | 1 << 2);
        for (int j = 0; j < (1 << 4); ++j) {
            bool ok = false;
            for (auto r : req) {
                if ((j & r) == r) {
                    ok = true;
                }
            }
            if (ok) {
                M.push_back(j);
            }
        }    
        for (int i = 0; i < n; ++i) {
            long long cnt = 0;
            for (auto F : M) {
                long long x = 1;
                for (int j = 0; j < 4; ++j) {
                    if (F & (1 << j)) {
                        (x *= norm(pow2[cnts[i][j]] - 1)) %= MOD;
                    }
                }
                cnt += x;
            }
            cnt = norm(cnt);
            res += cnt;
            res = norm(res);
        }
        return res;
    }

private:
    const static long long MOD = 998244353;

    vector<long long> pow2;
    vector<long long> F;
    vector<long long> IF;

    long long norm(long long a) {
        a %= MOD;
        if (a < 0) {
            a += MOD;
        }
        return a;
    }

    long long inverse(long long a) {
        long long b = MOD;
        long long u = 0, v = 1;
        a = norm(a);
        while (a != 0) {
            long long d = b / a;
            b -= d * a;
            u -= d * v;
            swap(a, b);
            swap(u, v);
        }
        return norm(u);
    }

    long long powM(long long x, long long e) {
        long long res = 1;
        while (e > 0) {
            if (e & 1) {
                res = res * x % MOD;
            }
            x = x * x % MOD;
            e >>= 1;
        }
        return res;
    }

    void init(int n) {
        F.clear();
        F.resize(n + 1, 1);
        IF = F;
        pow2.clear();
        pow2.resize(n + 1, 1);
        for (int i = 1; i <= n; ++i) {
            pow2[i] = pow2[i - 1] * 2 % MOD;
        }

        for (int i = 1; i <= n; ++i) {
            F[i] = F[i - 1] * i % MOD;
        }
        IF[n] = inverse(F[n]);
        for (int i = n - 1; i > 0; --i) {
            IF[i] = IF[i + 1] * (i + 1) % MOD;
        }
    }

    long long nCr(int n, int r) {
        if (r < 0 || r > n) {
            return 0;
        }
        long long res = F[n] * IF[r] % MOD * IF[n - r] % MOD;
        return res;
    }

    
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pair<int,int>> points;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        points.emplace_back(x, y);
    }
    Solution sol;
    cout << sol.solve(points) << "\n";

    return 0;
}

Measured memory_bytes: 19312