#include<bits/stdc++.h>
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;
using boost::rational;
using boost::multiprecision::cpp_int;

typedef pair<int,int> P;
constexpr ll MOD{998244353LL};
constexpr ll MAX_SIZE{3000010LL};
template <ll MOD = MOD>
class Mint
{
public:
    ll x;
    Mint() : x{0LL} {}
    Mint(ll x) : x{x % MOD} {}
    Mint operator-() const { return x ? MOD - x : 0; }
    Mint &operator+=(const Mint &a)
    {
        if ((x += a.x) >= MOD)
        {
            x -= MOD;
        }
        return *this;
    }
    Mint &operator-=(const Mint &a) { return *this += -a; }
    Mint &operator*=(const Mint &a)
    {
        (x *= a.x) %= MOD;
        return *this;
    }
    Mint &operator/=(const Mint &a)
    {
        Mint b{a};
        return *this *= b.power(MOD - 2);
    }
    Mint operator+(const Mint &a) const { return Mint(*this) += a; }
    Mint operator-(const Mint &a) const { return Mint(*this) -= a; }
    Mint operator*(const Mint &a) const { return Mint(*this) *= a; }
    Mint operator/(const Mint &a) const { return Mint(*this) /= a; }
    bool operator<(const Mint &a) const { return x < a.x; }
    bool operator==(const Mint &a) const { return x == a.x; }
    const Mint power(ll N)
    {
        if (N == 0)
        {
            return 1;
        }
        else if (N % 2 == 1)
        {
            return *this * power(N - 1);
        }
        else
        {
            Mint half = power(N / 2);
            return half * half;
        }
    }
};
template <ll MOD>
Mint<MOD> operator+(ll lhs, const Mint<MOD> &rhs)
{
    return rhs + lhs;
}
template <ll MOD>
Mint<MOD> operator-(ll lhs, const Mint<MOD> &rhs)
{
    return -rhs + lhs;
}
template <ll MOD>
Mint<MOD> operator*(ll lhs, const Mint<MOD> &rhs)
{
    return rhs * lhs;
}
template <ll MOD>
Mint<MOD> operator/(ll lhs, const Mint<MOD> &rhs)
{
    return Mint<MOD>{lhs} / rhs;
}
template <ll MOD>
istream &operator>>(istream &stream, Mint<MOD> &a)
{
    return stream >> a.x;
}
template <ll MOD>
ostream &operator<<(ostream &stream, const Mint<MOD> &a)
{
    return stream << a.x;
}
template <ll MOD = MOD, ll MAX_SIZE = MAX_SIZE>
class Combination
{
public:
    vector<Mint<MOD>> inv, fact, factinv;
    Combination() : inv(MAX_SIZE), fact(MAX_SIZE), factinv(MAX_SIZE)
    {
        inv[1] = 1;
        for (auto i = 2LL; i < MAX_SIZE; i++)
        {
            inv[i] = (-inv[MOD % i]) * (MOD / i);
        }
        fact[0] = factinv[0] = 1;
        for (auto i = 1LL; i < MAX_SIZE; i++)
        {
            fact[i] = Mint<MOD>(i) * fact[i - 1];
            factinv[i] = inv[i] * factinv[i - 1];
        }
    }
    Mint<MOD> operator()(int n, int k)
    {
        if (n >= 0 && k >= 0 && n - k >= 0)
        {
            return fact[n] * factinv[k] * factinv[n - k];
        }
        return 0;
    }
    Mint<MOD> catalan(int x, int y)
    {
        return (*this)(x + y, y) - (*this)(x + y, y - 1);
    }
};
// for C++14
using mint = Mint<MOD>;
using combination = Combination<MOD, MAX_SIZE>;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
cpp_int gcd(cpp_int x, cpp_int y) { return y ? gcd(y, x % y) : x; }
cpp_int lcm(cpp_int x, cpp_int y) { return x / gcd(x, y) * y; }


template<typename T> // T: type of cost
struct BIT {
    int n;
    vector<T> d;
    BIT(int n=0):n(n),d(n+1) {}
    void add(int i, T x=1) {
        for (i++; i <= n; i += i&-i) {
            d[i] += x;
        }
    }
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i&-i) {
            x += d[i];
        }
        return x;
    }
};

mint f(int a, int b, int c, int d) {
    mint res = 0;
    vector<int> num = {a,b,c,d};
    vector<mint> o(4), ox(4);
    rep(i,4) {
        ox[i] = mint(2).power(num[i]);
        o[i] = ox[i] - 1;
    }
    res += ox[0]*o[1]*o[2]*ox[3];
    res += o[0]*ox[1]*ox[2]*o[3];
    res -= o[0]*o[1]*o[2]*o[3];

    res += ox[0]*ox[1]*ox[2]*ox[3];
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    { // compress x
        map<int,int> mp;
        rep(i,n) mp[p[i].first] = 0;
        int j = 0;
        for (auto&& x : mp) x.second = j++;
        rep(i,n) p[i].first = mp[p[i].first];
    }
    { // compress y
        map<int,int> mp;
        rep(i,n) mp[p[i].second] = 0;
        int j = 0;
        for (auto&& x : mp) x.second = j++;
        rep(i,n) p[i].second = mp[p[i].second];
    }
    sort(p.begin(), p.end());
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    vector<int> d(n);
    rep(_,2) {
        { // calc a,b
            BIT<int> bit(n);
            rep(i,n) {
                a[i] = bit.sum(p[i].second);
                b[i] = i - a[i];
                bit.add(p[i].second);
            }
        }
        reverse(p.begin(),p.end());
        swap(a,c);
        swap(b,d);
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        reverse(c.begin(),c.end());
        reverse(d.begin(),d.end());
    }
    mint ans = 0;
    rep(i,n) {
        ans += f(a[i],b[i],c[i],d[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136