//header
#ifdef LOCAL
    #include "cxx-prettyprint-master/prettyprint.hpp"
    #define print(x) cout << x << endl
#else
    #define print(...) 42
#endif
    #pragma GCC optimize("Ofast")
    #include <bits/stdc++.h>
    //types
    using namespace std;
    using ll = long long;
    typedef pair < ll , ll >P;
    typedef vector<ll> vl;
    template< typename T >
    using mat = vector< vector< T > >;
    template <std::uint_fast64_t Modulus> class modint {
        using u64 = std::uint_fast64_t;

        public:
        u64 a;

        constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
        constexpr u64 &value() noexcept { return a; }
        constexpr const u64 &value() const noexcept { return a; }
        constexpr modint operator+(const modint rhs) const noexcept {
            return modint(*this) += rhs;
        }
        constexpr modint operator-(const modint rhs) const noexcept {
            return modint(*this) -= rhs;
        }
        constexpr modint operator*(const modint rhs) const noexcept {
            return modint(*this) *= rhs;
        }
        constexpr modint operator/(const modint rhs) const noexcept {
            return modint(*this) /= rhs;
        }
        constexpr modint &operator+=(const modint rhs) noexcept {
            a += rhs.a;
            if (a >= Modulus) {
            a -= Modulus;
            }
            return *this;
        }
        constexpr modint &operator-=(const modint rhs) noexcept {
            if (a < rhs.a) {
            a += Modulus;
            }
            a -= rhs.a;
            return *this;
        }
        constexpr modint &operator*=(const modint rhs) noexcept {
            a = a * rhs.a % Modulus;
            return *this;
        }
        constexpr modint &operator/=(modint rhs) noexcept {
            u64 exp = Modulus - 2;
            while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
            }
            return *this;
        }
        };
    //abbreviations
    #define all(x) (x).begin(), (x).end()
    #define reverse(x) (x).rbegin(), (x).rend()
    #define rep2(i,a,b) for(ll i=(a);i<(b);++i)
    #define rep(i,n) for(ll i=0;i<(n);++i)
    #define SZ(x) ((ll)(x).size())
    #define pb(x) push_back(x)
    #define ff first
    #define ss second
    //functions
    ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
    template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
    template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
    template< typename T >
    T mod_pow(T x, T n, const T &p) {
        T ret = 1;
        while(n > 0) {
            if(n & 1) (ret *= x) %= p;
            (x *= x) %= p;
            n >>= 1;
        }
        return ret;
    }
    uint64_t my_rand(void) {
        static uint64_t x = 88172645463325252ULL;
        x = x ^ (x << 13); x = x ^ (x >> 7);
        return x = x ^ (x << 17);
    }

//constant
#define INF 1'010'000'000'000'000'017LL
#define mod 998244353LL
#define eps 0.0001
//library
struct OrderedSet {
        vector< ll > data;
        ll num = 0;
        ll size = 1;

        OrderedSet(int sz) {
                while(size<sz)size<<=1;
                data.assign(size+1, 0);
        }

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

        void add(int k, ll x) {
                for(++k; k < data.size(); k += k & -k) data[k] += x;
                num+=x;
        }

        ll search(int k) {
                if(k<1)return 0;
                if(k>num)return size+1;
                ll x = 0, sx = 0;
                ll step = size;
                while(step){
                        ll y = x+step;
                        ll sy = sx+data[y];
                        if(sy<k){
                                x = y;
                                sx = sy;
                        }
                        step >>= 1;
                }
                return x;
        }
};

//main
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(20);
    ll N; cin>>N;
    vector<P> xy;
    vl Y;
    rep(i, N){
        ll x, y;
        cin>>x>>y;
        xy.pb(P(x, y));
        Y.pb(y);
    }
    sort(all(Y));
    OrderedSet L(N), R(N);
    rep(i, N) R.add(i, 1);
    sort(all(xy));
    modint<mod> ans;
    rep(i, N){
        ll y = distance(begin(Y), lower_bound(all(Y), xy[i].second));
        R.add(y, -1);
        ll ld = L.sum(y);
        modint<mod> ld_pow = mod_pow<ll>(2, ld, mod);
        ll lu = L.num-ld;
        modint<mod> lu_pow = mod_pow<ll>(2, lu, mod);
        ll rd = R.sum(y);
        modint<mod> rd_pow = mod_pow<ll>(2, rd, mod);
        ll ru = R.num-rd;
        modint<mod> ru_pow = mod_pow<ll>(2, ru, mod);
        ans+=(lu_pow-1)*(rd_pow-1)*ld_pow*ru_pow;
        ans+=(ld_pow-1)*(ru_pow-1)*lu_pow*rd_pow;
        ans-=(ld_pow-1)*(ru_pow-1)*(lu_pow-1)*(rd_pow-1);
        ans+=mod_pow<ll>(2, N-1, mod);
        L.add(y, 1);
    }
    cout << ans.value() << endl;
}

Measured memory_bytes: 10220