#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <numeric>
#include <climits>
#include <cfloat>
#include <bitset>
class Bit {
	std::vector<int> _vec;
public:
	Bit(const int size) : _vec(size, 0) {}
	int operator[](int position) const {
		int result = 0;
		while (position >= 0) {
			result += _vec[position];
			position -= ~position & (position + 1);
		}
		return result;
	}
	void clear() {
		std::fill(_vec.begin(), _vec.end(), 0);
	}
	void increment(int position) {
		while (position < _vec.size()) {
			++_vec[position];
			position += ~position & (position + 1);
		}
	}
	void decremenet(int position) {
		while (position < _vec.size()) {
			--_vec[position];
			position += ~position & (position + 1);
		}
	}
};
struct Point { int x, y; };
int main() {
	constexpr long long int mod = 998244353LL;
	int n; std::cin >> n;
	std::vector<long long int> power(n + 1, 1LL); for (auto i = 1; i <= n; ++i) power[i] = 2 * power[i - 1] % mod;
	std::set<int> x_coordinates, y_coordinates;
	std::vector<Point> points(n); for (auto& p : points) {
		std::cin >> p.x >> p.y;
		x_coordinates.insert(p.x); y_coordinates.insert(p.y);
	}
	std::vector<int> x_sorted, y_sorted; std::copy(x_coordinates.begin(), x_coordinates.end(), std::back_inserter(x_sorted)); std::copy(y_coordinates.begin(), y_coordinates.end(), std::back_inserter(y_sorted));
	for (auto& p : points) {
		p.x = std::distance(x_sorted.begin(), std::lower_bound(x_sorted.begin(), x_sorted.end(), p.x));
		p.y = std::distance(y_sorted.begin(), std::lower_bound(y_sorted.begin(), y_sorted.end(), p.y));
	}
	Bit lower_bit(y_coordinates.size()), higher_bit(y_coordinates.size());
	std::sort(points.begin(), points.end(), [](const Point& a, const Point& b) {return a.x < b.x; });
	for (const auto& p : points) {
		higher_bit.increment(p.y);
	}
	long long int result = power[n - 1] * n % mod;
	for (auto i = 0; i < n; ++i) {
		auto p = points[i];
		higher_bit.decremenet(p.y);
		auto right_down = higher_bit[p.y];
		auto right_up = (n - i - 1) - higher_bit[p.y];
		auto left_down = lower_bit[p.y];
		auto left_up =  i - lower_bit[p.y];
		result += ((power[right_down] - 1) * (power[right_up] - 1) % mod) * ((power[left_down] - 1) * (power[left_up] - 1) % mod) % mod;
		result += ((power[right_up] - 1) % mod) * ((power[left_down] - 1) * (power[left_up] - 1) % mod) % mod;
		result += ((power[right_down] - 1) % mod) * ((power[left_down] - 1) * (power[left_up] - 1) % mod) % mod;
		result += ((power[right_down] - 1) * (power[right_up] - 1) % mod) * ((power[left_up] - 1) % mod) % mod;
		result += ((power[right_down] - 1) * (power[right_up] - 1) % mod) * ((power[left_down] - 1) % mod) % mod;
		result += ((power[right_up] - 1) % mod) * ((power[left_down] - 1) % mod) % mod;
		result += ((power[right_down] - 1) % mod) * ((power[left_up] - 1) % mod) % mod;
		result %= mod;
		lower_bit.increment(p.y);
	}
	std::cout << (result % mod + mod) % mod << std::endl;
}


Measured memory_bytes: 25336