#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 998244353;
ll N;
vector<l_l> points;
vector<ll> x, revx;
vector<ll> y, revy;
multiset<ll> ychecked, revychecked;

ll beki(ll a, ll b) {
    if(b == 0) return 1;
    ll ret = beki(a, b / 2);
    ret = ret * ret % mod;
    if(b & 1) ret = ret * a % mod;
    return ret;
}
struct SegmentTree {
private:
    int n;
    vector<int> node;
 
public:
    SegmentTree() {
        int sz = 200500;
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        for(int i=0; i<sz; i++) node[i+n-1] = 0;
        for(int i=n-2; i>=0; i--) node[i] = (node[2*i+1] + node[2*i+2]);
    }
 
    void add(int x, int val) {
        x += (n - 1);
        node[x] += val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = (node[2*x+1] + node[2*x+2]);
        }
    }
    // hannkaikukann 
    int getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];
 
        int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        int vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return (vl + vr);
    }
};


map<ll, vector<ll>> mp;
map<ll, vector<ll>> revmp;
set<ll> already;
vector<ll> compx, compy;
int main() {
    cin >> N;
    SegmentTree seg;
    points.resize(N);
    for(int i = 0; i < N; i++) {
        cin >> points[i].first >> points[i].second;
        compx.push_back(points[i].first);
        compy.push_back(points[i].second);
    }
    sort(compx.begin(), compx.end());
    sort(compy.begin(), compy.end());
    for(int i = 0; i < N; i++) {
        //cin >> points[i].first >> points[i].second;
        auto itr = lower_bound(compx.begin(), compx.end(), points[i].first);
        points[i].first = distance(compx.begin(), itr);
        itr = lower_bound(compy.begin(), compy.end(), points[i].second);
        points[i].second = distance(compy.begin(), itr);
        x.push_back(points[i].first);
        y.push_back(points[i].second);
        revx.push_back(-points[i].first);
        revy.push_back(-points[i].second);
        mp[points[i].first].push_back(points[i].second);
        revmp[points[i].first].push_back(-points[i].second);
    }
    sort(points.begin(), points.end());
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    sort(revx.begin(), revx.end());
    sort(revy.begin(), revy.end());
    ll ans = 0;
    for(int i = 0; i < points.size(); i++) {
        if(already.find(points[i].first) == already.end()) {
            sort(mp[points[i].first].begin(), mp[points[i].first].end());
            sort(revmp[points[i].first].begin(), revmp[points[i].first].end());
            already.insert(points[i].first);
        }
        auto itr = lower_bound(y.begin(), y.end(), points[i].second);
        ll a = distance(y.begin(), itr);
        itr = lower_bound(revy.begin(), revy.end(), -points[i].second);
        ll b = distance(revy.begin(), itr);
        itr = lower_bound(x.begin(), x.end(), points[i].first);
        ll c = distance(x.begin(), itr);
        itr = lower_bound(revx.begin(), revx.end(), -points[i].first);
        ll d = distance(revx.begin(), itr);
        //cerr << i << " " << a << " " << b << " " << c << " " << d << endl;
        //itr = ychecked.lower_bound(points[i].second);
        //ll e = distance(ychecked.begin(), itr);
        ll e = seg.getsum(0, points[i].second);
        //itr = lower_bound(revychecked.begin(), revychecked.end(), -points[i].second);
        //ll g = distance(revychecked.begin(), itr);
        ll g = seg.getsum(points[i].second + 1, 200020);
        itr = lower_bound(mp[points[i].first].begin(), mp[points[i].first].end(), points[i].second);
        ll k = distance(mp[points[i].first].begin(), itr);
        itr = lower_bound(revmp[points[i].first].begin(), revmp[points[i].first].end(), -points[i].second);
        ll l = distance(revmp[points[i].first].begin(), itr);
        e -= l;
        ll f = a - e - k;
        ll h = b - g - l;
        //cerr << points[i].first << " " << points[i].second << endl;
        //cerr << a << " " << b << " " << c << " " << d << " " << e << " " << g << " " << k << " " << l << " " << f << " " << h << endl;
        ll now = beki(2, a) - 1;
        now += beki(2, b) - 1;
        now += beki(2, c) - 1;
        now += beki(2, d) - 1;
        now -= beki(2, e) - 1;
        now -= beki(2, f) - 1;
        now -= beki(2, g) - 1;
        now -= beki(2, h) - 1;
        now += 5 * mod;
        now %= mod;
        now = beki(2, N) - 1 - now;
        now += mod;
        now %= mod;
        ans += now;
        ans %= mod;
        cerr << now << endl;
        seg.add(points[i].second, 1);
        //cerr << seg.getsum(points[i].second, points[i].second + 1) << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 69220