#include <bits/stdc++.h>

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

/*
 *  y
 *  |
 * [1]-[ ]-[ ]      the rectangle that contains 1,3 also contains 2
 *  |   |   |       so f({1,3}} = 3
 * [ ]-[2]-[ ]
 *  |   |   | 
 * [ ]-[ ]-[3]-x
 */

const int mod = 998244353;
const int maxn = 2e5+5;
int tree[maxn*2];

void add(int i, const int v, const int n)
{
    for (tree[i+=n] += v; i > 1; i /= 2)
        tree[i/2] = tree[i] + tree[i^1];
}

int query(int i, int j, const int n)
{
    int ans = 0;
    for (i += n, j += n; i < j; i /= 2, j /= 2) {
        if (i&1) ans += tree[i++];
        if (j&1) ans += tree[--j];
    }
    return ans;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;    
    while (cin >> n) {
        vector<int> pw(n+1);
        pw[0] = 1;
        FOR(i,1,n+1)
            pw[i] = pw[i-1]*2 % mod;
        vector<PII> P(n); vector<int> Y(n);
        FOR(i,0,n) {
            cin >> P[i].first >> P[i].second;
            Y[i] = P[i].second;
        }
        sort(ALL(Y));
        map<int,int> M;
        FOR(i,0,n)
            M[Y[i]] = i;
        FOR(i,0,n)
            P[i].second = M[P[i].second];
        sort(ALL(P));
        vector<int> A(n),B(n),C(n),D(n);
        memset(tree,0,sizeof(tree));
        FOR(i,0,n) {
            const int y = P[i].second;
            A[i] = query(0,y+1,n);
            C[i] = query(y,n,n);
            add(y,1,n);
        }
        memset(tree,0,sizeof(tree));
        FORR(i,n-1,-1) {
            const int y = P[i].second;
            B[i] = query(y,n,n);
            D[i] = query(0,y+1,n);
            add(y,1,n);
        }
        int ans = 0;
        FOR(i,0,n) {
            const LL a = pw[A[i]];
            const LL b = pw[B[i]];
            const LL c = pw[C[i]];
            const LL d = pw[D[i]];
            /* select */
            ans += a * b % mod * c % mod * d % mod;
            ans %= mod;
            /* not select */
            ans += (a-1) * (b-1) % mod * c % mod * d % mod;
            ans %= mod;
            ans += (c-1) * (d-1) % mod * a % mod * b % mod;
            ans %= mod;
            /* IEP */
            ans -= (a-1) * (b-1) % mod * (c-1) % mod * (d-1) % mod;
            ans %= mod;
        }
        ans += mod;
        ans %= mod;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 17408