#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

typedef unsigned short us;
typedef short s;
typedef unsigned long ul;
typedef long l;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const l INF = 1e9 + 1;
const ll MOD = 998244353;
const l PRIME = 200003;
const ll L_INF = 1e18 + 1;
const double EPS = 10e-9;

#define FOR(x, y, z) for (l z = x; z < y; z++)
#define FORE(x, y, z) for (l z = x; z <= y; z++)
#define FORD(x, y, z) for (l z = x; z > y; z--)
#define FORDE(x, y, z) for (l z = x; z >= y; z--)
#define REP(x, y) for (l y = 0; y < x; y++)

#define PF push_front
#define POF pop_front
#define PB push_back
#define POB pop_back
#define MP make_pair

using namespace std;
using namespace __gnu_pbds;

typedef tree<l, null_type, less<l>, rb_tree_tag, tree_order_statistics_node_update> statistic_tree;

struct point
{
    l x;
    l y;
};

l num_points;
ll result = 0;
point points[2*100005];
statistic_tree count_tree;

void compress()
{
    map<l, l> m;

    REP(num_points, i)
        m[points[i].x] = 0;

    l indx = 0;

    for(auto v: m)
        m[v.first] = indx++;

    REP(num_points, i)
        points[i].x = m[points[i].x];

    m.clear();

    REP(num_points, i)
        m[points[i].y] = 0;

    indx = 0;

    for(auto v: m)
        m[v.first] = indx++;

    REP(num_points, i)
        points[i].y = m[points[i].y];
}

bool compare(point a, point b)
{
    return a.x < b.x;
}

ll mul(ll a, ll b)
{
    return ((a%MOD) * (b%MOD))%MOD;
}

ll add(ll a, ll b)
{
    return ((a%MOD) + (b%MOD))%MOD;
}

ll sub(ll a, ll b)
{
    return (a - b + MOD)%MOD;
}

ll fastExponentation(ll a, ll p)
{
    ll res = 1;

    while(p)
    {
        if(p&1)
            res = mul(res, a);

        a = mul(a, a);
        p >>= 1;
    }

    return res;
}

ll inv(ll base)
{
    return fastExponentation(base, MOD-2);
}

ll dvd(ll a, ll b)
{
    return mul(a, inv(b));
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	cin >> num_points;

	REP(num_points, i)
        cin >> points[i].x >> points[i].y;

    compress();

    sort(points, points+num_points, compare);

    REP(num_points, i)
    {
        result = add(result, fastExponentation(2, num_points));

        l count_above = num_points - points[i].y - 1;
        l count_below = points[i].y;
        l count_left = i;
        l count_right = num_points-i-1;

        result = sub(result, fastExponentation(2, count_above));
        result = sub(result, fastExponentation(2, count_below));
        result = sub(result, fastExponentation(2, count_left));
        result = sub(result, fastExponentation(2, count_right));

        l left_above = count_tree.order_of_key(num_points+1) - count_tree.order_of_key(points[i].y);
        l left_below = count_tree.order_of_key(points[i].y+1);
        l right_above = count_above - left_above;
        l right_below = count_below - left_below;

        result = add(result, fastExponentation(2, left_above));
        result = add(result, fastExponentation(2, left_below));
        result = add(result, fastExponentation(2, right_above));
        result = add(result, fastExponentation(2, right_below));

        result = sub(result, 1);

        if(count_tree.order_of_key(points[i].y+1) - count_tree.order_of_key(points[i].y) == 0)
            count_tree.insert(points[i].y);

    }

    cout << result << "\n";
}

Measured memory_bytes: 17920