N = gets.to_i
Xs, Ys = readlines.map{|l| l.split.map(&:to_i)}.transpose
M = 998244353

p2 = N.times.each_with_object([1]){|_, o| o << o.last * 2 % M}
ys = N.times.sort_by{|n| Ys[n]}.each_with_object([]).with_index{|(n, o), i| o[n] = i}
r, bit = 0, Array.new(N + 1, 0)
ys.sort_by.with_index{|y, i| Xs[i]}.each_with_index do |y, i|
  j = y + 1
  while j <= N
    bit[j] += 1
    j += j & -j
  end
  d, j = 0, y
  while j > 0
    d += bit[j]
    j -= j & -j
  end
  c = i - d
  b = (N - 1) - y - c
  a = (N - 1) - b - c - d
  r = (r + p2[b + c] + p2[c + d] + p2[d + a] + p2[a + b] - p2[a] - p2[b] - p2[c] - p2[d]) % M
end
puts (p2[N]*N - (r + N)) % M