// See https://aka.ms/new-console-template for more information using System.Collections; using System.Runtime.InteropServices; internal class Program { public static void Main(string[] args) { const int mod = 998244353; long ans = 1; int n = int.Parse(Console.ReadLine()); var x=Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var y=Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); List> xy = new List>(2*n); for (int i = 0; i < n; i++) { xy.Add(Tuple.Create(x[i],0)); xy.Add(Tuple.Create(y[i],1)); } xy.Sort(); var c = mkar(2, 0); for (int i = 0; i < n; i++) { c[xy[i].Item2]++; } for (int i = 1; i <= c[0]; i++) ans = ans * i % mod; for (int i = 1; i <= c[1]; i++) ans = ans * i % mod; Console.WriteLine(ans); } public static List mkar(int n, int val) { List res = new List(n); for(int i=0;i