Mod = 998244353 N = int(input()) X = list(map(int, input().split())) Y = list(map(int, input().split())) XY = [] for i in range(N): XY.append((X[i], 0)) XY.append((Y[i], 1)) XY.sort() cnt = 0 for i in range(N): if(XY[i][1] == 1): cnt += 1 ans = 1 Mod = 998244353 for i in range(1, cnt + 1): ans *= i ans %= Mod for i in range(1, N - cnt + 1): ans *= i ans %= Mod print(ans)