### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

from collections import defaultdict
from collections import deque
import heapq
import numpy as np

MOD = 998244353

def DD(arg): return defaultdict(arg)

def inv(n): return pow(n, MOD-2, MOD)

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]


class NumberTheoreticTransformation():
    # 2^n-th root of unity
    ntt_prime_data = {
        17: (3, 4),
        998244353: (31, 23)
    }
    
    def __init__(self, ntt_len, MOD = 998244353):
        """
        ntt_len：2べきが必要
        MOD：準備してあるいくつか限定
        """
        self.N = ntt_len
        N = ntt_len
        self.lgN = N.bit_length() - 1
        self.bit_reverse_index = self.bit_reverse(self.lgN)
        self.MOD = MOD
        self.Ninv = pow(N, MOD - 2, MOD)
        r, d = NumberTheoreticTransformation.ntt_prime_data[MOD]
        assert d >= self.lgN
        r = pow(r, 2 ** (d - self.lgN), MOD) # 1の原子 N 乗根
        powr = self.make_zeta_power(r)
        self.Zeta = [powr[N//2::N//(1<<(i+1))] for i in range(self.lgN)]
        self.ZetaInv = [powr[N//2:0:-N//(1<<(i+1))] for i in range(self.lgN)]
        
    def bit_reverse(self, lgN):
        """
        N = 2 ** lgN までの lgN 桁bit反転
        bit_reverse(3) = np.array([000,100,010,110,001,101,011,111]) = np.array([0,4,2,6,1,5,3,7])
        """
        N = 1 << lgN
        A = np.empty(N, np.int32)
        A[0] = 0
        for i in range(lgN):
            x = 1 << i
            A[:x] <<= 1
            A[x:x+x] = A[:x] + 1
        return A
    
    def make_zeta_power(self, r):
        MOD = self.MOD
        x = np.empty(self.N, np.int64)
        x[0] = 1; x[1] = r
        for n in range(self.lgN):
            x[1 << n: 1 << (n+1)] = x[:1 << n] * (r * x[(1 << n) - 1] % MOD) % MOD
        return x
 
    def ntt(self, A, inverse):
            MOD = self.MOD
            A = A[self.bit_reverse_index]
            N = self.N; lgN = self.lgN
            M = 1
            
            Zeta = self.Zeta if not inverse else self.ZetaInv
            for Z in Zeta:
                A = A.reshape(-1,M+M)
                u = A[:,:M]
                t = A[:,M:]
                t *= Z[None,:]
                t += u
                u <<= 1
                u -= t
                M <<= 1
                A %= MOD
            A = A.ravel()
            if inverse:
                A *= self.Ninv
            A %= MOD
            return A
    
    def convolve(self, A, B):
        MOD = self.MOD
        LA = len(A); LB = len(B)
        N = self.N
        A = np.resize(A, N); A[LA:] = 0
        B = np.resize(B, N); B[LB:] = 0
        fA = self.ntt(A, inverse = False)
        fB = self.ntt(B, inverse = False)
        fA *= fB; fA %= MOD
        return self.ntt(fA, inverse = True)
      
      
N = int(input())
ntt_len = 1 << (N + N).bit_length()
ntt = NumberTheoreticTransformation(ntt_len, MOD)

nokori = [1]
for n in range(1,2*N+10):
  nokori.append((nokori[-1]*(2*n-1)*(2*n)*inv(2)*inv(n))%MOD)

dic = DD(int)
for _ in range(N*2):
  dic[int(input())] += 1
A = [dic[k] for k in dic]
  
P = []
for a in A:
  temp = 1
  count = 0
  P.append([temp])
  while a >= 2:
    temp *= a*(a-1)//2
    temp %= MOD
    count += 1
    P[-1].append((temp*gyaku_kaijo(count))%MOD)
    a -= 2

data = [np.array(p) for p in P]
Q = []
for i in range(len(data)):
  heapq.heappush(Q,(len(data[i]),i))

while len(Q)>1:
  a,p = heapq.heappop(Q)
  b,q = heapq.heappop(Q)
  temp = ntt.convolve(data[p], data[q])[:a+b-1]
  data.append(temp)
  heapq.heappush(Q,(len(temp),len(data)-1))
Q = list(data[-1])

ans = 0
M = len(Q)

def sign(x):
  if x%2: return -1
  else: return 1

for i in range(M):
  ans += sign(i) * Q[i] * nokori[N-i]
  ans %= MOD
  
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

from collections import defaultdict
from collections import deque
import heapq

MOD = 998244353

def DD(arg): return defaultdict(arg)

def inv(n): return pow(n, MOD-2, MOD)

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

ROOT = 3
MOD = 998244353
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(input())

nokori = [1]
for n in range(1,2*N+10):
  nokori.append((nokori[-1]*(2*n-1)*(2*n)*inv(2)*inv(n))%MOD)

dic = DD(int)
for _ in range(N*2):
  dic[int(input())] += 1
A = [dic[k] for k in dic]
  
P = []
for a in A:
  temp = 1
  count = 0
  P.append([temp])
  while a >= 2:
    temp *= a*(a-1)//2
    temp %= MOD
    count += 1
    P[-1].append((temp*gyaku_kaijo(count))%MOD)
    a -= 2

Q = []
for i in range(len(P)):
  heapq.heappush(Q,(len(P[i]),i))

while len(Q)>1:
  _,p = heapq.heappop(Q)
  _,q = heapq.heappop(Q)
  temp = convolution(P[p], P[q])
  P.append(temp)
  heapq.heappush(Q,(len(temp),len(P)-1))
Q = list(P[-1])

ans = 0
M = len(Q)

def sign(x):
  if x%2: return -1
  else: return 1

for i in range(M):
  ans += sign(i) * Q[i] * nokori[N-i]
  ans %= MOD
  
print(ans)