#include <bits/stdc++.h>
using namespace std;
int N;
int H[101010];
const signed long long mo = 998244353;
signed long long fact2[101010];
const int NUM_ = 400001;
signed long long fact[NUM_ + 1], factr[NUM_ + 1], inv[NUM_ + 1];
signed long long comb(signed long long N_, signed long long C_) {
  if (C_ < 0 || C_ > N_) return 0;
  return factr[C_] * fact[N_] % mo * factr[N_ - C_] % mo;
}
vector<signed long long> V[101010];
signed long long modpow(signed long long a, signed long long n = mo - 2) {
  signed long long r = 1;
  while (n) r = r * ((n % 2) ? a : 1) % mo, a = a * a % mo, n >>= 1;
  return r;
}
template <class T>
vector<T> fft(vector<T> v, bool rev = false) {
  int n = v.size(), i, j, m;
  for (i = 0, j = 1; j < n - 1; j++) {
    for (int k = n >> 1; k > (i ^= k); k >>= 1)
      ;
    if (i > j) swap(v[i], v[j]);
  }
  for (int m = 2; m <= n; m *= 2) {
    T wn = modpow(5, (mo - 1) / m);
    if (rev) wn = modpow(wn);
    for (i = 0; i < n; i += m) {
      T w = 1;
      for (int j1 = i, j2 = i + m / 2; j2 < i + m; j1++, j2++) {
        T t1 = v[j1], t2 = (signed long long)w * v[j2] % mo;
        v[j1] = t1 + t2;
        v[j2] = t1 + mo - t2;
        while (v[j1] >= mo) v[j1] -= mo;
        while (v[j2] >= mo) v[j2] -= mo;
        w = (signed long long)w * wn % mo;
      }
    }
  }
  if (rev) {
    signed long long rv = modpow(n);
    for (i = 0; i < (n); i++) v[i] = (signed long long)v[i] * rv % mo;
  }
  return v;
}
template <class T>
vector<T> MultPoly(vector<T> P, vector<T> Q, bool resize = false) {
  if (resize) {
    int maxind = 0, pi = 0, qi = 0, i;
    int s = 2;
    for (i = 0; i < (P.size()); i++)
      if (norm(P[i])) pi = i;
    for (i = 0; i < (Q.size()); i++)
      if (norm(Q[i])) qi = i;
    maxind = pi + qi + 1;
    while (s * 2 < maxind) s *= 2;
    P.resize(s * 2);
    Q.resize(s * 2);
  }
  P = fft(P), Q = fft(Q);
  for (int i = 0; i < P.size(); i++) P[i] = (signed long long)P[i] * Q[i] % mo;
  return fft(P, true);
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  fact2[1] = 1;
  for (i = 3; i <= 101000; i += 2) fact2[i] = fact2[i - 2] * i % mo;
  inv[1] = fact[0] = factr[0] = 1;
  for (int i = 2; i <= NUM_; ++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
  for (int i = 1; i <= NUM_; ++i)
    fact[i] = fact[i - 1] * i % mo, factr[i] = factr[i - 1] * inv[i] % mo;
  cin >> N;
  for (i = 0; i < (2 * N); i++) {
    cin >> x;
    H[x]++;
  }
  priority_queue<pair<int, int>> P;
  for (i = 0; i < (100001); i++)
    if (H[i]) {
      V[i].push_back(1);
      for (j = 1; 2 * j <= H[i]; j++) {
        V[i].push_back(comb(H[i], 2 * j) * fact2[2 * j - 1]);
      }
      P.push({-(int)V[i].size(), i});
    }
  while (P.size() > 1) {
    x = P.top().second;
    P.pop();
    y = P.top().second;
    P.pop();
    V[x] = MultPoly(V[x], V[y], 1);
    V[y].clear();
    P.push({-(int)V[x].size(), x});
  }
  signed long long ret = 0;
  x = P.top().second;
  for (i = 0; i < (V[x].size()); i++)
    if (V[x][i]) {
      signed long long v = V[x][i] * (i == N ? 1 : fact2[2 * (N - i) - 1]);
      if (i % 2)
        ret += mo - v;
      else
        ret += v;
    }
  cout << ret % mo << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
