using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC136F
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = ReadInt;
            long mod = 998244353;

            int[] x = new int[N];
            int[] y = new int[N];
            for (int i = 0; i < N; i++)
            {
                x[i] = ReadInt;
                y[i] = ReadInt;
            }

            dp = new long[2 * N + 2].Select(a => -1L).ToArray();

            //座標圧縮
            var toValueX = x.Distinct().OrderBy(v => v).ToArray();
            var toValueY = y.Distinct().OrderBy(v => v).ToArray();

            var indexFromValueTableX = toValueX.Select((value, index) => new { value, index }).ToDictionary(p => p.value, p => p.index);
            var indexFromValueTableY = toValueY.Select((value, index) => new { value, index }).ToDictionary(p => p.value, p => p.index);

            int countX = indexFromValueTableX.Count;
            int countY = indexFromValueTableY.Count;

            x = x.Select(v => indexFromValueTableX[v]).ToArray();
            y = y.Select(v => indexFromValueTableY[v]).ToArray();

            //x順にソート
            Point[] points = new Point[N];
            for (int i = 0; i < N; i++)
            {
                points[i] = new Point() { x = x[i], y = y[i] };
            }
            points = points.OrderBy(a => a.x).ToArray();
            for (int i = 0; i < N; i++)
            {
                x[i] = points[i].x;
                y[i] = points[i].y;
            }

            //1次元bit二つ
            BIT bitL = new BIT(N);
            BIT bitR = new BIT(N);
            for (int i = 0; i < N; i++)
            {
                bitR.Add(y[i] + 1, y[i] + 1, 1);
            }

            //各星について総数を求める.
            long ans = 0;
            long all = ModPow(2, N, mod);
            for (int i = 0; i < N; i++)
            {
                //スライド式
                long c1 = bitR.Sum(y[i] + 2, N);
                long c2 = bitL.Sum(y[i] + 2, N);
                long c3 = bitL.Sum(1, y[i]);
                long c4 = bitR.Sum(1, y[i]);

                long powRU = ModPow(2, c1, mod);
                long powLU = ModPow(2, c2, mod);
                long powLD = ModPow(2, c3, mod);
                long powRD = ModPow(2, c4, mod);

                long powU = ModPow(2, c1 + c2, mod);
                long powL = ModPow(2, c2 + c3, mod);
                long powD = ModPow(2, c3 + c4, mod);
                long powR = ModPow(2, c4 + c1, mod);

                long sum = (all + powRU + powLU + powLD + powRD - powU - powL - powD - powR - 1 + mod) % mod;

                ans = (ans + sum) % mod;

                bitL.Add(y[i] + 1, y[i] + 1, 1);
                bitR.Add(y[i] + 1, y[i] + 1, -1);
            }

            Console.WriteLine(ans);
        }

        struct Point
        {
            public int x;
            public int y;
        }

        /// <summary>
        /// a^n (mod p)
        /// nが非常に大きい時に有効
        /// </summary>
        /// <param name="a"></param>
        /// <param name="n"></param>
        /// <param name="mod"></param>
        /// <returns></returns>
        static long[] dp;
        public static long ModPow(long a, long n, long p)
        {
            if (dp[n] != -1) return dp[n];
            if (n == 0) return 1;
            if (n == 1) return a % p;
            if (n % 2 == 1) return (a * ModPow(a, n - 1, p)) % p;

            long t = ModPow(a, n / 2, p);
            return dp[n] = (t * t) % p;
        }
    }

    class BIT
    {
        long[] bit0, bit1;  //1-indexed
        int n;
        public BIT(int n)
        {
            bit0 = new long[n + 1];
            bit1 = new long[n + 1];
            this.n = n;
        }

        public long Sum(int l, int r)
        {
            long ret = 0;
            ret += Sum(bit0, r) + Sum(bit1, r) * r;
            ret -= Sum(bit0, l - 1) + Sum(bit1, l - 1) * (l - 1);
            return ret;
        }

        long Sum(long[] bit, int i)
        {
            long s = 0;
            while (i > 0)
            {
                s += bit[i];
                i -= i & -i;
            }
            return s;
        }

        public void Add(int l, int r, int a)
        {
            Add(bit0, l, -a * (l - 1));
            Add(bit1, l, a);
            Add(bit0, r + 1, a * r);
            Add(bit1, r + 1, -a);
        }

        void Add(long[] bit, int i, int a)
        {
            while (i <= n)
            {
                bit[i] += a;
                i += i & -i;
            }
        }
    }
}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {

    }
}


Measured memory_bytes: 73704