#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int MAX_N = 50 * 1000;
const int MAX_H = 2 * MAX_N;
int a[MAX_H + 1];
int dp[2 * MAX_N + 1];
int new_dp[2 * MAX_N + 1];
int f[2 * MAX_N + 1];
int inv_f[2 * MAX_N + 1];
int suf_sum[MAX_H + 1];
int power(int a, int b) {
  if (b == 0) return 1;
  int result = power(a, b / 2);
  return (long long)result * result % MOD * (b % 2 == 1 ? a : 1) % MOD;
}
int C(int n, int r) {
  return (long long)f[n] * inv_f[n - r] % MOD * inv_f[r] % MOD;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int max_h = INT_MIN;
  for (int i = 0; i < 2 * n; i++) {
    int h;
    cin >> h;
    a[h]++;
    max_h = max(max_h, h);
  }
  f[0] = 1;
  for (int i = 1; i <= 2 * n; i++) {
    f[i] = (long long)f[i - 1] * i % MOD;
  }
  inv_f[2 * n] = power(f[2 * n], MOD - 2);
  for (int i = 2 * n - 1; i >= 0; i--) {
    inv_f[i] = (long long)inv_f[i + 1] * (i + 1) % MOD;
  }
  for (int i = max_h - 1; i >= 0; i--) {
    suf_sum[i] = suf_sum[i + 1] + a[i + 1];
  }
  dp[0] = 1;
  for (int i = 1; i <= max_h; i++) {
    for (int j = 0; j <= suf_sum[i]; j++) {
      int r = min(a[i], j);
      int l = max((a[i] + j - suf_sum[j] + 1) / 2, 0);
      for (int k = l; k <= r; k++) {
        new_dp[j] += (long long)dp[a[i] + j - 2 * k] * C(j, k) % MOD *
                     C(a[i], k) % MOD * f[k] % MOD;
        new_dp[j] %= MOD;
      }
    }
    swap(dp, new_dp);
    memset(new_dp, 0, sizeof(new_dp));
  }
  cout << dp[0] << '\n';
  return 0;
}
