import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())


# 998244353 = 119*2**23+1

mod = 998244353
primitive_root = 3  # mod の原始根
roots = [pow(primitive_root,(mod-1) >> i,mod) for i in range(24)]
inv_roots = [pow(r,mod-2,mod) for r in roots]
# roots[i] = 1 の 2**i 乗根、inv_roots[i] = 1 の 2**i 乗根の逆元

# 順番は変わる


def ntt(A,n):
    for i in range(n):
        m = 1 << (n-i-1)
        for start in range(1 << i):
            w = 1
            start *= m*2
            for j in range(m):
                A[start+j],A[start+j+m] = (A[start+j]+A[start+j+m]) % mod,(A[start+j]-A[start+j+m])*w % mod
                w *= roots[n-i]
                w %= mod
    return A


def inv_ntt(A,n):
    for i in range(n):
        m = 1 << i
        for start in range(1 << (n-i-1)):
            w = 1
            start *= m*2
            for j in range(m):
                A[start+j],A[start+j+m] = (A[start+j]+A[start+j+m]*w) % mod,(A[start+j]-A[start+j+m]*w) % mod
                w *= inv_roots[i+1]
                w %= mod
    a = pow(2,n*(mod-2),mod)
    for i in range(1 << n):
        A[i] *= a
        A[i] %= mod
    return A


def convolution(A,B):
    a,b = len(A),len(B)
    deg = a+b-2
    n = deg.bit_length()
    N = 1 << n
    A += [0]*(N-a)  # A の次数を 2冪-1 にする
    B += [0]*(N-b)  # B の次数を 2冪-1 にする
    A = ntt(A,n)
    B = ntt(B,n)
    C = [(A[i]*B[i]) % mod for i in range(N)]
    C = inv_ntt(C,n)
    return C[:deg+1]


N = I()
A = [0]*100001  # A[i] = 身長 i の人が何人いるか
for _ in range(2*N):
    A[I()] += 1


fac = [1]  # fac[i] = i!
for i in range(1,N+1):
    fac.append((fac[-1]*i) % mod)

fac_inv = []  # fac_inv[i] = (i!)**-1
for i in range(N+1):
    fac_inv.append(pow(fac[i],mod-2,mod))

double_fac = [1]  # double[i] = (2*i-1)!!
for i in range(1,N+1):
    double_fac.append((double_fac[-1]*(2*i-1)) % mod)


def nCr(n,r):
    if n < r:
        return 0
    return (fac[n]*fac_inv[r]*fac_inv[n-r]) % mod


B = []
for i in range(100001):
    a = A[i]
    if a < 2:
        continue
    elif a > N:
        print(0)
        exit()
    else:
        B.append([(nCr(a,2*j)*double_fac[j]) % mod for j in range(a//2+1)])

b = len(B)

r = 1
while r < b:
    for i in range(0,b,r*2):
        if i+r < b:
            B[i] = convolution(B[i],B[i+r])
    r *= 2

if b > 0:
    C = B[0]  # B 内の多項式の積
else:
    C = [1]

ans = 0
r = 1
for i in range(min(len(C),N+1)):
    ans += C[i]*double_fac[N-i]*r
    ans %= mod
    r = -r

print(ans)
