#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int cnt[100003];
long long dp[25003];
long long fac[50003], ifac[50003];
long long D[100003];
long long pwr(long long a, long long b) {
  if (b == 0)
    return 1;
  else if (b == 2)
    return (a * a) % MOD;
  else if (b & 1)
    return (pwr(a, b - 1) * a) % MOD;
  else
    return pwr(pwr(a, b / 2), 2);
}
long long C(long long a, long long b) {
  if (b > a) return 0;
  return ((fac[a] * ifac[a - b]) % MOD * ifac[b]) % MOD;
}
int main() {
  fac[0] = ifac[0] = 1;
  D[0] = D[2] = 1;
  for (int i = 4; i <= 100000; i++) D[i] = (D[i - 2] * (i - 1)) % MOD;
  for (int i = 1; i <= 50000; i++) {
    fac[i] = (fac[i - 1] * i) % MOD;
    ifac[i] = pwr(fac[i], MOD - 2);
  }
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= 2 * n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  dp[0] = 1;
  int sz = 0;
  for (int i = 1; i <= 100000; i++) {
    int inc = cnt[i] / 2;
    if (!inc) continue;
    sz += inc;
    for (int j = sz; j >= 0; j--) {
      for (int k = 1; k <= j; k++) {
        if (k * 2 > cnt[i]) break;
        long long tam = (dp[j - k] * C(cnt[i], k * 2)) % MOD;
        tam = (tam * D[k * 2]) % MOD;
        dp[j] = (dp[j] + tam) % MOD;
      }
    }
  }
  long long res = 0;
  int tanda = 1;
  for (int i = 0; i <= sz; i++) {
    res += (tanda * dp[i] * D[2 * n - 2 * i]) % MOD;
    res %= MOD;
    tanda *= -1;
  }
  printf("%lld\n", (res + MOD) % MOD);
}
