import sys
readline = sys.stdin.readline
from collections import Counter
from heapq import heappop as hpp, heappush as hp


MOD = 998244353
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%MOD
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], MOD -2, MOD)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % MOD
    return frac, fraci
frac, fraci = frac(1341398)
def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%MOD

#from submission 17076021
ROOT = 3
roots  = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 の 2^i 乗根
iroots = [pow(x,MOD-2,MOD) for x in roots] # 1 の 2^i 乗根の逆元
 
def untt(a,n):
    for i in range(n):
        m = 1<<(n-i-1)
        for s in range(1<<i):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m])%MOD, (a[s+p]-a[s+p+m])*w_N%MOD
                w_N = w_N*roots[n-i]%MOD
 
def iuntt(a,n):
    for i in range(n):
        m = 1<<i
        for s in range(1<<(n-i-1)):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m]*w_N)%MOD, (a[s+p]-a[s+p+m]*w_N)%MOD
                w_N = w_N*iroots[i+1]%MOD
            
    inv = pow((MOD+1)//2,n,MOD)
    for i in range(1<<n):
        a[i] = a[i]*inv%MOD
 
def convolution(a,b):
    la = len(a)
    lb = len(b)
    deg = la+lb-2
    n = deg.bit_length()
    if min(la, lb) <= 50:
        if la < lb:
            la,lb = lb,la
            a,b = b,a
        res = [0]*(la+lb-1)
        for i in range(la):
            for j in range(lb):
                res[i+j] += a[i]*b[j]
                res[i+j] %= MOD
        return res
 
    N = 1<<n
    a += [0]*(N-len(a))
    b += [0]*(N-len(b))
    untt(a,n)
    untt(b,n)
    for i in range(N):
      a[i] = a[i]*b[i]%MOD
    iuntt(a,n)
    return a[:deg+1]

N = int(readline())
H = [int(readline()) for _ in range(2*N)]
Ch = list(Counter(H).values())
Ch.sort()

table = []
Q = []
cnt = 0
for c in Ch:
    if c == 1:
        continue
    res = [0]*(c//2 + 1)
    for i in range(c//2 + 1):
        res[i] = comb(c, 2*i)*frac[2*i]*fraci[i]%MOD

    table.append(res)
    hp(Q, (c//2, cnt))
    cnt += 1

if not table:
    print(frac[2*N]*fraci[N]*pow((MOD+1)//2, N, MOD)%MOD)
else:
    M = len(table)
    
    for _ in range(M-1):
        c1, i = hpp(Q)
        c2, j = hpp(Q)
        table[i] = convolution(table[i], table[j])
        table[j] = None
        hp(Q, (c1+c2, i))
    c, i = hpp(Q)
    res = table[i]
    ans = 0
    for i in range(len(res)):
        ans = (ans + (-1 if i&1 else 1)*res[i]*comb(N, i)*frac[2*N-2*i]*frac[i]) % MOD
    
    ans = ans*pow((MOD+1)//2, N, MOD)*fraci[N]%MOD
    print(ans)