import numpy as np
from collections import Counter
from heapq import *
import sys
input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


def convolve(a, b):
    l = len(a) + len(b)
    return np.round(np.real(np.fft.irfft(np.fft.rfft(a, l) * np.fft.rfft(b, l), l))).astype(np.int64)


class Arr:

    def __init__(self, arr):
        self.l = len(arr)
        self.arr = arr

    def __lt__(self, other):
        return self.l < other.l


N = int(input())
hs = list(map(int, read().split()))

ch = Counter(hs)
arrays = []
for k, c in ch.items():
    arr = [1]
    while c >= 2:
        arr.append(c * (c - 1) // 2)
        c -= 2
    arrays.append(Arr(np.array(arr)))

heapify(arrays)
while len(arrays) >= 2:
    a1 = heappop(arrays)
    a2 = heappop(arrays)
    heappush(arrays, Arr(convolve(a1.arr, a2.arr)))
    
final = arrays[0].arr

MOD = 998244353
table_len = 100010

fac = [1, 1]
for i in range(2, table_len):
    fac.append(fac[-1] * i % MOD)

finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len-1, 0, -1):
    finv[i - 1] = finv[i] * i % MOD
    

ans = 0

for i in range(N + 1):
    tmp = pow(2, MOD - 1 - N + i, MOD) * fac[2 * (N - i)] % MOD * finv[N - i] % MOD
    # print("t", tmp)
    if len(final) > i:
        tmp *= int(final[i])
        tmp %= MOD
    else:
        break
    if i % 2 == 1:
        ans -= tmp
    else:
        ans += tmp
    ans %= MOD
    # print("a", ans)

print(ans % MOD)