import math n = int(input()) x = [(int(z), 0) for z in input().split()] y = [(int(z), 1) for z in input().split()] cnt = 0 for _, c in sorted(x + y)[n]: cnt += c m = 998244353 a = math.factorial(cnt) a %= m b = math.factorial(n - cnt) b %= m print(a * b % m)