#include <bits/stdc++.h>
using namespace std;
const int maxn = (1 << 18), mod = 998244353;
inline void inc(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline void dec(int &x, int y) {
  x -= y;
  if (x < 0) x += mod;
}
inline int ppw(int x, int y) {
  int z = 1;
  while (y) {
    if (y & 1) z = 1ll * z * x % mod;
    y >>= 1;
    x = 1ll * x * x % mod;
  }
  return z;
}
int n, i;
int cc[100005], h[100005];
vector<int> v[100005];
int fac[maxn + 5], inv[maxn + 5], fi[maxn + 5], lg[maxn + 5], pw[maxn + 5],
    w[maxn + 5], iw[maxn + 5];
int rev[maxn + 5], a[maxn + 5], b[maxn + 5];
inline int c(int x, int y) {
  return 1ll * fac[x] * fi[y] % mod * fi[x - y] % mod;
}
inline void init() {
  int i;
  for (i = 2; i <= maxn; i++) lg[i] = lg[i >> 1] + 1;
  pw[0] = 1;
  for ((i) = 1; (i) <= (lg[maxn]); (i)++) pw[i] = pw[i - 1] * 2;
  fac[0] = fac[1] = inv[1] = fi[0] = fi[1] = 1;
  for (i = 2; i <= maxn; i++) {
    fac[i] = 1ll * fac[i - 1] * i % mod;
    inv[i] = (mod - mod / i) * 1ll * inv[mod % i] % mod;
    fi[i] = 1ll * fi[i - 1] * inv[i] % mod;
  }
  w[0] = 1;
  w[1] = ppw(3, (mod - 1) / maxn);
  for (i = 2; i <= maxn; i++) w[i] = 1ll * w[i - 1] * w[1] % mod;
  iw[maxn] = ppw(w[maxn], mod - 2);
  for (i = maxn - 1; i >= 0; i--) iw[i] = 1ll * iw[i + 1] * w[1] % mod;
}
inline int getrev(int x) {
  int i, s = 1;
  while (s < x) s *= 2;
  rev[0] = 0;
  for ((i) = 1; (i) <= (s - 1); (i)++)
    rev[i] = ((rev[i >> 1] >> 1) | ((i & 1) << (lg[s] - 1)));
  return s;
}
inline void ntt(int *a, int n, int *w) {
  int i, j, k;
  for ((i) = 0; (i) < (n); (i)++)
    if (rev[i] < i) swap(a[i], a[rev[i]]);
  for (i = 1; i < n; i <<= 1) {
    int ys = maxn / i / 2;
    for (j = 0; j < n; j += i + i) {
      int *t = w;
      for ((k) = 0; (k) < (i); (k)++) {
        int x = a[j + k], y = 1ll * a[j + k + i] * (*t) % mod;
        a[j + k] = x + y;
        if (a[j + k] >= mod) a[j + k] -= mod;
        a[j + k + i] = x - y;
        if (a[j + k + i] < 0) a[j + k + i] += mod;
        t += ys;
      }
    }
  }
}
inline vector<int> mul(const vector<int> &aa, const vector<int> &bb) {
  vector<int> ans;
  long long br = 1ll * aa.size() * bb.size(),
            ft =
                1ll * (aa.size() + bb.size()) * lg[aa.size() + bb.size()] * 10 +
                100;
  if (br < ft) {
    while (ans.size() + 1 < aa.size() + bb.size()) ans.push_back(0);
    int i, j;
    for ((i) = 0; (i) < (aa.size()); (i)++)
      for ((j) = 0; (j) < (bb.size()); (j)++)
        inc(ans[i + j], 1ll * aa[i] * bb[j] % mod);
  } else {
    int len = getrev(aa.size() + bb.size()), i;
    for ((i) = 0; (i) < (len); (i)++) a[i] = b[i] = 0;
    for ((i) = 0; (i) < (aa.size()); (i)++) a[i] = aa[i];
    for ((i) = 0; (i) < (bb.size()); (i)++) b[i] = bb[i];
    ntt(a, len, w);
    ntt(b, len, w);
    for ((i) = 0; (i) < (len); (i)++) a[i] = 1ll * a[i] * b[i] % mod;
    ntt(a, len, iw);
    int inv = ppw(len, mod - 2);
    for ((i) = 0; (i) < (len); (i)++) ans.push_back(1ll * a[i] * inv % mod);
  }
  while (!ans.empty() && !ans.back()) ans.pop_back();
  return ans;
}
vector<int> solve(int l, int r) {
  if (l == r) return v[l];
  int mid = (l + r) / 2;
  vector<int> v0 = solve(l, mid), v1 = solve(mid + 1, r);
  return mul(v0, v1);
}
int main() {
  init();
  scanf("%d", &n);
  for ((i) = 1; (i) <= (n + n); (i)++) {
    scanf("%d", &h[i]);
    cc[h[i]]++;
  }
  for ((i) = 1; (i) <= (100000); (i)++) {
    v[i].resize(cc[i] + 1);
    int j;
    for ((j) = 0; (j) < (cc[i] / 2 + 1); (j)++) {
      v[i][cc[i] - j - j] = ((!(j & 1)) ? 1ll : (mod - 1ll)) * fac[j] *
                            c(cc[i], j + j) % mod * c(j + j, j) % mod *
                            ppw(inv[2], max(0, j)) % mod;
    }
  }
  vector<int> ans = solve(1, 100000);
  int res = 0;
  for ((i) = 0; (i) < (ans.size()); (i)++)
    if (!(i & 1)) {
      res = (res + 1ll * ans[i] * c(i, i / 2) % mod *
                       ppw(inv[2], max(0, i / 2)) % mod * fac[i / 2]) %
            mod;
    }
  cout << res << endl;
  return 0;
}
