import sys input = sys.stdin.readline mod=998244353 N=int(input()) X=list(map(int,input().split())) Y=list(map(int,input().split())) X.sort() Y.sort(reverse=True) A=0 for i in range(N): if X[i]>Y[i]: A+=1 ANS=1 for i in range(1,A+1): ANS=ANS*i%mod for i in range(1,N-A+1): ANS=ANS*i%mod print(ANS)