N = int(input()) X = list(map(int,input().split())) Y = list(map(int,input().split())) P = 998244353 X.sort(reverse = True) Y.sort(reverse = True) count = 0 for _ in range(N): u = X[-1] v = Y[-1] if u < v: count += 1 X.pop() else: Y.pop() U = count V = N - count ans = 1 for _ in range(2): U,V = V,U for i in range(U): ans = ans * i % P print(ans)