#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T itr1, T itr2) {
  auto now = itr1;
  while (now < itr2) {
    cout << *now << " ";
    now++;
  }
  cout << endl;
}
const long long MOD = 998244353;
const long long LLINF = pow(2, 61) - 1;
const long long INF = pow(2, 30) - 1;
vector<long long> fac;
void c_fac(long long x = pow(10, 6) + 10) {
  fac.resize(x, true);
  for (long long i = (long long)0; i < (long long)x; i++)
    fac[i] = i ? (fac[i - 1] * i) % MOD : 1;
}
long long inv(long long a, long long m = MOD) {
  long long b = m, x = 1, y = 0;
  while (b != 0) {
    long long d = a / b;
    a -= b * d;
    swap(a, b);
    x -= y * d;
    swap(x, y);
  }
  return (x + m) % m;
}
long long nck(long long n, long long k) {
  return fac[n] * inv(fac[k] * fac[n - k] % MOD) % MOD;
}
long long modpow(long long x, long long p) {
  long long result = 1, now = 1, pm = x;
  while (now <= p) {
    if (p & now) {
      result = result * pm % MOD;
    }
    now *= 2;
    pm = pm * pm % MOD;
  }
  return result;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  return b == 0 ? a : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
struct FastNumberTheoreticTransform {
  long long size = 1, size_x12, root;
  vector<long long> x1, x2, theta;
  FastNumberTheoreticTransform(long long s = 10) {
    while (size < s) size *= 2;
    root = modpow(3, MOD / size);
    x1.resize(size);
    x2.resize(size);
    theta.resize(size);
    for (long long i = (long long)0; i < (long long)size; i++)
      theta[i] = i == 0 ? 1 : theta[i - 1] * root % MOD;
  }
  void set(vector<long long> &v1, vector<long long> &v2) {
    size_x12 = v1.size() + v2.size() - 1;
    x1 = v1;
    x2 = v2;
  }
  vector<long long> convolution(vector<long long> &x, bool rev, long long s,
                                long long pos = 0) {
    if (s == 1) return {x[pos]};
    vector<long long> ex = convolution(x, rev, s / 2, pos),
                      ox = convolution(x, rev, s / 2, pos + size / s);
    vector<long long> result(s);
    for (long long i = (long long)0; i < (long long)s; i++)
      result[i] =
          (ex[i % (s / 2)] + theta[size / s * i] * ox[i % (s / 2)]) % MOD;
    if (rev && s == size) {
      reverse(result.begin() + 1, result.end());
      long long invs = inv(size);
      for (auto &x : result) x = x * invs % MOD;
    }
    return result;
  };
  vector<long long> calc(vector<long long> &v1, vector<long long> &v2) {
    set(v1, v2);
    vector<long long> cx1 = convolution(x1, false, size),
                      cx2 = convolution(x2, false, size);
    vector<long long> cx12(size);
    for (long long i = (long long)0; i < (long long)size; i++)
      cx12[i] = cx1[i] * cx2[i] % MOD;
    vector<long long> x12 = convolution(cx12, true, size);
    vector<long long> result(size_x12);
    copy(x12.begin(), x12.begin() + size_x12, result.begin());
    return result;
  }
};
int main() {
  long long N;
  cin >> N;
  N *= 2;
  long long h[N];
  for (long long i = (long long)0; i < (long long)N; i++) cin >> h[i];
  sort(h, h + N);
  map<long long, long long> m;
  for (long long i = (long long)0; i < (long long)N; i++) m[h[i]]++;
  c_fac();
  vector<vector<long long>> fnc;
  for (auto x : m) {
    if (x.second > N / 2) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (auto x : m) {
    long long l = x.second / 2 + 1;
    vector<long long> count(l);
    for (long long i = (long long)0; i < (long long)l; i++)
      count[i] = i == 0 ? 1
                        : count[i - 1] * nck(x.second - (i - 1) * 2, 2) % MOD *
                              inv(i) % MOD;
    if (count.size() >= 2) fnc.push_back(count);
  }
  vector<long long> mul = {1};
  FastNumberTheoreticTransform FNTT(N);
  for (auto x : fnc) mul = FNTT.calc(mul, x);
  vector<long long> num(N);
  for (long long i = (long long)0; i < (long long)N; i++)
    num[i] = i == 0 ? 1 : num[i - 1] * nck(i * 2, 2) % MOD * inv(i) % MOD;
  long long result = 0;
  for (long long i = (long long)0; i < (long long)mul.size(); i++)
    result = i % 2 == 0 ? (result + num[N / 2 - i] * mul[i] % MOD) % MOD
                        : (result - num[N / 2 - i] * mul[i] % MOD + MOD) % MOD;
  cout << result << endl;
  return 0;
}
