#include <bits/stdc++.h>
const long long mod = 998244353;
using namespace std;
long long modpow(long long a, long long n, long long mod) {
  if (n == 0) return 1;
  if (n % 2) {
    return ((a % mod) * (modpow(a, n - 1, mod) % mod)) % mod;
  } else {
    return modpow((a * a) % mod, n / 2, mod) % mod;
  }
}
int rev(int x, int n) {
  int ret = 0;
  for (int i = 0; i < n; i++) {
    ret <<= 1;
    ret |= (x >> i) & 1;
  }
  return ret;
}
void DFT(long long f[], long long F[], int n, long long mod, long long root) {
  int N = 1 << n;
  for (int i = 0; i < N; i++) F[rev(i, n)] = f[i];
  long long a, b, x, z;
  for (int i = 1; i <= n; i++) {
    int l = 1 << i;
    z = modpow(root, 1 << (n - i), mod);
    for (int j = 0; j < N / l; j++) {
      x = 1;
      for (int k = 0; k < l / 2; k++) {
        a = F[j * l + k], b = F[j * l + k + l / 2];
        F[j * l + k] = a + x * b % mod;
        F[j * l + k + l / 2] = a - x * b % mod + mod;
        if (F[j * l + k] >= mod) F[j * l + k] -= mod;
        if (F[j * l + k + l / 2] >= mod) F[j * l + k + l / 2] -= mod;
        x *= z, x %= mod;
      }
    }
  }
}
void IDFT(long long F[], long long f[], int n, long long mod, long long root) {
  int N = 1 << n;
  for (int i = 0; i < N; i++) f[rev(i, n)] = F[i];
  root = modpow(root, mod - 2, mod);
  long long a, b, x, z;
  for (int i = 1; i <= n; i++) {
    int l = 1 << i;
    z = modpow(root, 1 << (n - i), mod);
    for (int j = 0; j < N / l; j++) {
      x = 1;
      for (int k = 0; k < l / 2; k++) {
        a = f[j * l + k], b = f[j * l + k + l / 2];
        f[j * l + k] = a + x * b % mod;
        f[j * l + k + l / 2] = a - x * b % mod + mod;
        if (f[j * l + k] >= mod) f[j * l + k] -= mod;
        if (f[j * l + k + l / 2] >= mod) f[j * l + k + l / 2] -= mod;
        x *= z, x %= mod;
      }
    }
  }
  long long Ninv = modpow(N, mod - 2, mod);
  for (int i = 0; i < N; i++) f[i] *= Ninv, f[i] %= mod;
}
long long n;
long long a[100005];
long long seki[200005];
long long root;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    Q;
vector<long long> vec[100005];
long long getlog(long long n) {
  long long ret = 0;
  for (; n; n /= 2) ret++;
  return ret;
}
long long f[1 << 19], g[1 << 19], F[1 << 19], G[1 << 19];
long long calc(long long u, long long v) {
  long long degu = vec[u].size() - 1, degv = vec[v].size() - 1;
  long long n = getlog(degu + degv + 1), N = 1 << n;
  for (int i = 0; i < N; i++) f[i] = F[i] = g[i] = G[i] = 0;
  for (int i = 0; i < vec[u].size(); i++) f[i] = vec[u][i];
  for (int i = 0; i < vec[v].size(); i++) g[i] = vec[v][i];
  DFT(f, F, n, mod, modpow(root, 1 << (23 - n), mod));
  DFT(g, G, n, mod, modpow(root, 1 << (23 - n), mod));
  for (int i = 0; i < N; i++) F[i] *= G[i], F[i] %= mod;
  IDFT(F, f, n, mod, modpow(root, 1 << (23 - n), mod));
  vec[u].resize(degu + degv + 1);
  for (int i = 0; i <= degu + degv; i++) vec[u][i] = f[i];
  return degu + degv;
}
const int FACT_MAX = 200005;
long long fact[FACT_MAX], fact_inv[FACT_MAX];
long long modpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2) {
    return ((a % mod) * (modpow(a, n - 1) % mod)) % mod;
  } else {
    return modpow((a * a) % mod, n / 2) % mod;
  }
}
void make_fact() {
  long long val = 1;
  fact[0] = 1;
  for (int i = 1; i < FACT_MAX; i++) {
    val *= i;
    val %= mod;
    fact[i] = val;
  }
  fact_inv[FACT_MAX - 1] = modpow(fact[FACT_MAX - 1], mod - 2);
  for (int i = FACT_MAX - 2; i >= 0; i--) {
    fact_inv[i] = fact_inv[i + 1] * (i + 1) % mod;
  }
}
long long comb(long long n, long long k) {
  long long ret = 1;
  ret *= fact[n];
  ret *= fact_inv[k], ret %= mod;
  ret *= fact_inv[n - k], ret %= mod;
  return ret;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  make_fact();
  cin >> n;
  long long h;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> h;
    a[h]++;
  }
  root = modpow(3, 119, mod);
  seki[0] = 1;
  for (int i = 2; i < 200005; i += 2) seki[i] = seki[i - 2] * comb(i, 2) % mod;
  for (int i = 1; i <= 100000; i++) {
    if (a[i] < 2) continue;
    vec[i].resize(a[i] / 2 + 1);
    long long mul = 1;
    for (int j = 0; j <= a[i] / 2; j++) {
      vec[i][j] = mul * fact_inv[j] % mod;
      if (a[i] - 2 * j >= 0) mul *= comb(a[i] - 2 * j, 2), mul %= mod;
    }
    Q.push(pair<long long, long long>(a[i] / 2 + 1, i));
  }
  while (Q.size() >= 2) {
    long long u = Q.top().second;
    Q.pop();
    long long v = Q.top().second;
    Q.pop();
    long long res = calc(u, v);
    Q.push(pair<long long, long long>(res, u));
  }
  long long x = Q.top().second;
  long long ans = 0;
  for (int i = 0; i < vec[x].size(); i++) {
    long long tmp = vec[x][i];
    tmp *= seki[2 * (n - i)], tmp %= mod;
    tmp *= fact_inv[n - i], tmp %= mod;
    if (i % 2)
      ans += mod - tmp, ans %= mod;
    else
      ans += tmp, ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
