#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
long long power(long long a, long long p, long long mod) {
  if (p == 0) return 1;
  long long ans = power(a, p / 2, mod);
  ans = (ans * ans) % mod;
  if (p % 2) ans = (ans * a) % mod;
  return ans;
}
struct NTT {
  int N;
  vector<int> perm;
  int mod, root, inv, pw;
  NTT(int mod, int root, int inv, int pw)
      : mod(mod), root(root), inv(inv), pw(pw) {}
  void precalculate() {
    perm.resize(N);
    perm[0] = 0;
    for (int k = 1; k < N; k <<= 1) {
      for (int i = 0; i < k; i++) {
        perm[i] <<= 1;
        perm[i + k] = 1 + perm[i];
      }
    }
  }
  void fft(vector<long long> &v, bool invert = false) {
    if (v.size() != perm.size()) {
      N = v.size();
      assert(N && (N & (N - 1)) == 0);
      precalculate();
    }
    for (int i = 0; i < N; i++)
      if (i < perm[i]) swap(v[i], v[perm[i]]);
    for (int len = 2; len <= N; len <<= 1) {
      long long factor = invert ? inv : root;
      for (int i = len; i < pw; i <<= 1) factor = (factor * factor) % mod;
      for (int i = 0; i < N; i += len) {
        long long w = 1;
        for (int j = 0; j < len / 2; j++) {
          long long x = v[i + j], y = (w * v[i + j + len / 2]) % mod;
          v[i + j] = (x + y) % mod;
          v[i + j + len / 2] = (x - y + mod) % mod;
          w = (w * factor) % mod;
        }
      }
    }
    if (invert) {
      long long n1 = power(N, mod - 2, mod);
      for (long long &x : v) x = (x * n1) % mod;
    }
  }
  vector<long long> multiply(vector<long long> a, vector<long long> b) {
    int n = 1;
    while (n < a.size() + b.size()) n <<= 1;
    a.resize(n);
    b.resize(n);
    fft(a);
    fft(b);
    for (int i = 0; i < n; i++) a[i] = (a[i] * b[i]) % mod;
    fft(a, true);
    return a;
  }
};
NTT ntt(998244353, 15311432, 469870224, 1 << 23);
int sum(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
int sub(int a, int b) { return a - b < 0 ? a - b + MOD : a - b; }
int mul(int a, int b) { return (1LL * a * b) % MOD; }
int pw(int a, int b) {
  if (!b) return 1;
  int r = pw(a, b / 2);
  r = mul(r, r);
  if (b % 2) r = mul(r, a);
  return r;
}
const int MAXX = 1e5 + 7;
int fact[MAXX], ifact[MAXX];
int nCr(int n, int r) {
  if (r < 0 || n < r) return 0;
  return mul(fact[n], mul(ifact[r], ifact[n - r]));
}
int fr[MAXX];
int pinv[MAXX];
int dfact[MAXX];
vector<vector<long long> > w;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  fact[0] = 1;
  for (int i = 1; i < MAXX; i++) fact[i] = mul(i, fact[i - 1]);
  ifact[MAXX - 1] = pw(fact[MAXX - 1], MOD - 2);
  for (int i = MAXX - 2; i >= 0; i--) ifact[i] = mul(i + 1, ifact[i + 1]);
  pinv[0] = 1;
  pinv[1] = pw(2, MOD - 2);
  for (int i = 2; i < MAXX; i++) pinv[i] = mul(pinv[i - 1], pinv[1]);
  dfact[0] = 1;
  for (int i = 2; i < MAXX; i += 2) dfact[i] = mul(dfact[i - 2], i - 1);
  int n;
  cin >> n;
  for (int i = 0; i < n + n; i++) {
    int h;
    cin >> h;
    fr[h]++;
  }
  priority_queue<pair<int, int> > pq;
  for (int i = 1; i < MAXX; i++) {
    if (fr[i] == 0) continue;
    w.emplace_back();
    for (int j = 0; j + j <= fr[i]; j++) {
      w.back().push_back(
          mul(fact[fr[i]], mul(ifact[j], mul(ifact[fr[i] - j - j], pinv[j]))));
    }
    pq.emplace(-w.size(), w.size() - 1);
  }
  while (pq.size() > 1) {
    pair<int, int> u = pq.top();
    pq.pop();
    pair<int, int> v = pq.top();
    pq.pop();
    w[u.second] = ntt.multiply(w[u.second], w[v.second]);
    while (w[u.second].size() > 1 && w[u.second].back() == 0)
      w[u.second].pop_back();
    pq.emplace(-w[u.second].size(), u.second);
  }
  int z = pq.top().second;
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    int tmp = mul(w[z][i], dfact[(n - i) * 2]);
    if (i & 1)
      ans = sub(ans, tmp);
    else
      ans = sum(ans, tmp);
  }
  cout << ans << "\n";
  return 0;
}
