////////////////////////////////////////
///  tu3 pro-con template            ///
////////////////////////////////////////
#include "bits/stdc++.h"
using namespace std;

// -- typedefs -- //
#define EPS 1e-9
typedef long long llong;

// -- loop macros -- //
#define REP(i,n) for (auto i = decltype(n)(0); i < (n); i++)
#define RREP(i,n) for (auto i = (n)-1; i >= 0; i--)
#define FOR(i,s,n) for (auto i = (s); i < (n); i++)
#define FORR(i,s,n) for (auto i = (n)-1; i >= (s); i--)
#define FORE(exp) for (auto && exp)
#define allof(c) c.begin(), c.end()
#define partof(c,s,e) c.begin() + (s), c.begin() + (e)

// -- functors -- //
#define PREDICATE(t,a,...) [&](const t & a) -> bool { return __VA_ARGS__; }
#define PRED(a,...) PREDICATE(auto,a,__VA_ARGS__)
#define COMPARISON(t,a,b,...) [&](const t & a, const t & b) -> bool { return __VA_ARGS__; }
#define COMP(a,b,...) COMPARISON(auto,a,b,__VA_ARGS__)
#define CONV1(a,...) [&](const auto & a) -> auto { return __VA_ARGS__; }
#define CONV2(a,b,...) [&](const auto & a, const auto & b) -> auto { return __VA_ARGS__; }
#define CONV3(a,b,c,...) [&](const auto & a, const auto & b, const auto & c) -> auto { return __VA_ARGS__; }

// -- I/O Helper -- //
struct _Reader { istream& cin; template <class T> _Reader operator ,(T& rhs) { cin >> rhs; return *this; } };
struct _Writer { ostream& cout; const char* d{ " " }; bool f{}; template <class T> _Writer operator ,(const T& rhs) { cout << (f ? d : "") << rhs; f = 1; return *this; } };
#define READ(t,...) t __VA_ARGS__; (_Reader{cin}), __VA_ARGS__
#define WRITE(...) do { (_Writer{cout}), __VA_ARGS__; cout << endl; } while (false)
#define WRITELN(...)  do { (_Writer{cout, "\n"}), __VA_ARGS__; cout << endl; } while (false)
#ifdef _DEBUG
#define DEBUG(...) (_Writer{cerr}), "DEBUG -> ", __VA_ARGS__, "\n"
#else
#define DEBUG(...)
#endif

// -- vevector -- //
template <class T> struct vevector : vector<vector<T>> { vevector(size_t n = 0, size_t m = 0, const T & initial = T()) : vector<vector<T>>(n, vector<T>(m, initial)) { } };
template <class T> struct vevevector : vector<vevector<T>> { vevevector(size_t n = 0, size_t m = 0, size_t l = 0, const T & initial = T()) : vector<vevector<T>>(n, vevector<T>(m, l, initial)) { } };
template <class T> struct vevevevector : vector<vevevector<T>> { vevevevector(size_t n = 0, size_t m = 0, size_t l = 0, size_t k = 0, const T & initial = T()) : vector<vevevector<T>>(n, vevevector<T>(m, l, k, initial)) { } };

namespace std {
	template <class T1, class T2> istream& operator >> (istream& in, pair<T1, T2>& p) { in >> p.first >> p.second; return in; }
	template <class T1, class T2> ostream& operator << (ostream& out, const pair<T1, T2>& p) { out << p.first << " " << p.second; return out; }
}

template <class T> T read() { T t; cin >> t; return t; }
template <class T> vector<T> read(int n) { vector<T> v; REP(i, n) { v.push_back(read<T>()); } return v; }
template <class T> vevector<T> read(int n, int m) { vevector<T> v; REP(i, n) v.push_back(read<T>(m)); return v; }
template <class T> vector<T> readjag() { return read<T>(read<int>()); }
template <class T> vevector<T> readjag(int n) { vevector<T> v; REP(i, n) v.push_back(readjag<T>()); return v; }

template <class T> struct iter_range_t { T beg, end; };
template <class T> iter_range_t<T> iter_range(T beg, T end) { return iter_range_t<T>{beg, end}; }
template <class T> ostream& operator << (ostream& out, iter_range_t<T> v) { if (v.beg != v.end) { out << *v.beg++; while (v.beg != v.end) { out << " " << *v.beg++; } } return out; }
template <class T> ostream& operator << (ostream& out, const vector<T>& v) { return out << iter_range(allof(v)); }

// -- etc -- //
template <class T> T infinity_value();
template <> int infinity_value<int>() { return int(1) << 28; }
template <> llong infinity_value<llong>() { return llong(1) << 60; }
template <> double infinity_value<double>() { return 1e+300 * 1e+300; }
#define INF(T) infinity_value<T>()

inline int sign_of(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
template <class TInt> bool in_range(TInt val, TInt min, TInt max) { return val >= min && val < max; }
template <> bool in_range<double>(double val, double min, double max) { return val - min > -EPS && val - max < EPS; }
template <class TInt> bool in_range2d(TInt x, TInt y, TInt w, TInt h) { return x >= 0 && x < w && y >= 0 && y < h; }
vector<int> iotavn(int start, int count) { vector<int> r(count); iota(allof(r), start);	return r; }


//// start up ////
void solve();
int32_t main()
{
	//auto classic_table = ctype<char>::classic_table();
	//vector<ctype<char>::mask> ctable(classic_table, classic_table + ctype<char>::table_size);
	//ctable['-'] |= ctype_base::space; // as delimitor
	//cin.imbue(locale(cin.getloc(), new ctype<char>(ctable.data())));

	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(std::numeric_limits<double>::max_digits10);
	solve();

	return 0;
}

/// 座圧 座標圧縮
template <class T>
struct CoordinateCompression
{
	map<T, int> comp{};
	vector<T> decomp{};
	vector<T> init(const vector<T>& orig)
	{
		decomp = orig;
		//decomp.push_back(numeric_limits<T>::min());
		//decomp.push_back(numeric_limits<T>::max());
		sort(allof(decomp));
		decomp.erase(unique(allof(decomp)), decomp.end());
		REP(i, decomp.size()) { comp[decomp[i]] = i; }
		vector<T> ret(orig.size());
		REP(i, orig.size()) { ret[i] = comp[orig[i]]; }
		return ret;
	}
	size_t size() { return decomp.size(); }
	T operator[](int x) { return decomp[x]; } ///< 圧縮後の値xはもともと何の値だったのか？
};
template <class T>
struct CoordinateCompression2D
{
	CoordinateCompression<T> Xs, Ys;

	template <class P>
	vector<P> init(const vector<P>& orig)
	{
		size_t N = orig.size();
		vector<T> x(N); REP(i, N) { x[i] = orig[i].x; } x = Xs.init(x);
		vector<T> y(N); REP(i, N) { y[i] = orig[i].y; } y = Ys.init(y);
		vector<P> ret(N); REP(i, N) { ret[i] = { x[i], y[i] }; }
		return ret;
	}
	struct size2D { size_t x, y; };
	size2D size() { return { Xs.size(), Ys.size() }; }

	template <class P>
	P operator[](P p) { return { Xs[p.x], Ys[p.y] }; }
};


// modを法としたxのy乗を求める。(繰り返し二乗法)
inline llong modPow(llong x, llong y, llong mod)
{
	llong r = 1;
	for (; y > 0; y >>= 1)
	{
		if (y & 1) { r = r * x % mod; }
		x = x * x % mod;
	}
	return r;
}


/// 2分セグメント木。RMQとかが解ける。
template<class T, class TParentFunc>
struct SegTreeT
{
	int size;
	vector<T> tree;
	TParentFunc parent;
	T initialValue;
	static constexpr unsigned int msb(unsigned int v) { REP(i, 5) v |= v >> (1 << i); return (v >> 1) + 1; }

	SegTreeT(int count, TParentFunc parentBuilder, T initialFill)
		: size(msb(count - 1) << 1)
		, tree(size * 2)
		, parent(parentBuilder)
		, initialValue(initialFill)
	{
		fill(partof(tree, size, size + size), initialFill);
		rebuild();
	}

	// []を使うと更新されないのでrebuildすること。数が少なければupdateの方がよい。
	T& operator[](int i) { return tree[i + size]; }
	void rebuild() { RREP(i, size) { tree[i] = parent(tree[i * 2], tree[i * 2 + 1]); } }

	void update(int index, T value)
	{
		tree[index + size] = value;
		for (int i = (index + size) / 2; i > 0; i /= 2)
			tree[i] = parent(tree[i * 2], tree[i * 2 + 1]);
	}

	T query(int s, int e, int i, int l, int r, T value)
	{
		if (r <= s || e <= l) return value;
		if (s <= l && r <= e) return parent(value, tree[i]);
		value = query(s, e, i * 2, l, (l + r) / 2, value);
		value = query(s, e, i * 2 + 1, (l + r) / 2, r, value);
		return value;
	}

	T query(int begin, int end, T initialValue) { return query(begin, end, 1, 0, size, initialValue); }
	T query(int begin, int end) { return query(begin, end, initialValue); }
};

template<class T, class TParentFunc = const T & (*)(const T&, const T&)>
auto SegTree(int N, TParentFunc f = min, T initialValue = INF(T))
{
	return SegTreeT<T, TParentFunc>(N, f, initialValue);
}

////////////////////
//// template end
////////////////////
void solve()
{
	READ(int, N);

	struct P
	{
		int x, y;
		int lt, lb, rt, rb;
	};

	std::vector<P> Ps;
	REP(i, N)
	{
		READ(int, x, y);
		Ps.push_back({ x,y });
	}
	Ps = CoordinateCompression2D<int>().init(Ps);
	std::sort(allof(Ps), COMP(a, b, a.x != b.x ? a.x < b.x : a.y < b.y));

	{
		auto seg = SegTree(N, plus<>(), 0ll);
		REP(i, N)
		{
			Ps[i].lt = seg.query(0, Ps[i].y);
			Ps[i].lb = seg.query(Ps[i].y + 1, N);
			seg.update(Ps[i].y, 1);
		}
	}

	{
		auto seg = SegTree(N, plus<>(), 0ll);
		RREP(i, N)
		{
			Ps[i].rt = seg.query(0, Ps[i].y);
			Ps[i].rb = seg.query(Ps[i].y + 1, N);
			seg.update(Ps[i].y, 1);
		}
	}

	const llong mod = 998244353;
	llong ans = 0;
	REP(i, N)
	{
		P p = Ps[i];

		llong a = 0;
		a = a + modPow(2, p.lt + p.rt, mod) - 1;
		a = a + modPow(2, p.rt + p.rb, mod) - 1;
		a = a + modPow(2, p.rb + p.lb, mod) - 1;
		a = a + modPow(2, p.lb + p.lt, mod) - 1;
		a = a - (modPow(2, p.lt, mod) - 1) + mod;
		a = a - (modPow(2, p.rt, mod) - 1) + mod;
		a = a - (modPow(2, p.rb, mod) - 1) + mod;
		a = a - (modPow(2, p.lb, mod) - 1) + mod;
		a %= mod;

		a = ((modPow(2, N, mod) - 1) - a + mod) % mod;

		ans += a;
		ans %= mod;
	}
	WRITE(ans);

}


Measured memory_bytes: 33644