#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return f == 1 ? x : -x;
}
inline void print(int x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x >= 10) print(x / 10);
  putchar((x % 10) | 48);
}
int n, m;
int h[100010];
int tmp[100010];
int cnt[100010];
map<pair<int, int>, int> ma;
int fac[100010], ifac[100010];
const int mod = 998244353;
inline int C(int x, int y) {
  if (x == 0 || y == 0) return 1;
  return 1ll * fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}
int sum[100010];
inline int dp(int i, int j) {
  if (j > sum[i] || j > n - sum[i + 1]) return 0;
  if (j < 0) return 0;
  if (ma.count(make_pair(i, j))) return ma[make_pair(i, j)];
  if (i == 0) return 0;
  for (int k = 0; k <= cnt[i] && k <= n - sum[i]; ++k) {
    ma[make_pair(i, j)] += 1ll * dp(i - 1, j - (cnt[i] - k) + k) *
                           C(cnt[i], k) % mod * C(j - (cnt[i] - k) + k, k) %
                           mod * fac[k] % mod;
  }
  return ma[make_pair(i, j)];
}
int qpow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    k >>= 1;
  }
  return res;
}
int main() {
  n = read();
  n <<= 1;
  ma[make_pair(0, 0)] = 1;
  fac[1] = 1;
  fac[0] = 1;
  for (int i = 2; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
  ifac[n] = qpow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; --i) ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;
  for (int i = 1; i <= n; ++i) tmp[i] = read();
  sort(tmp + 1, tmp + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (tmp[i] != tmp[i - 1])
      cnt[++m] = 1;
    else
      cnt[m]++;
  }
  for (int i = m; i >= 1; --i) sum[i] = sum[i + 1] + cnt[i];
  printf("%d\n", dp(m, 0));
  return 0;
}
