M=998244353 n=int(input()) f=[1] for i in range(1,n+1): f+=[f[-1]*i%M] x=list(map(int,input().split())) y=list(map(int,input().split())) z=[] for i in range(n): z+=[(x[i],0)] z+=[(y[i],1)] z.sort() c=sum(z[i][1] for i in range(n)) print((f[c]*f[n-c])%M)