#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int add(int a, int b) {
  a += b;
  if (a >= MOD) {
    return a - MOD;
  }
  if (a < 0) {
    return a + MOD;
  }
  return a;
}
int mul(int a, int b) { return a * (long long)b % MOD; }
int pw(int a, int b) {
  int r = 1;
  while (b) {
    if (b & 1) {
      r = mul(r, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return r;
}
int dv(int a, int b) { return mul(a, pw(b, MOD - 2)); }
const int N = (int)1e5 + 7;
int n;
int y;
int a[N];
int f[N];
int c[N];
int fact[N];
int ifact[N];
int dp[1000][1000];
int comb(int n, int k) { return mul(fact[n], mul(ifact[k], ifact[n - k])); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  fact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = mul(fact[i - 1], i);
  }
  ifact[N - 1] = dv(1, fact[N - 1]);
  for (int i = N - 2; i >= 0; i--) {
    ifact[i] = mul(ifact[i + 1], i + 1);
  }
  cin >> n;
  map<int, int> f;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> a[i];
    f[a[i]]++;
  }
  for (auto &it : f) {
    c[++y] = it.second;
  }
  if (n >= 1000) {
    return 0;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= y; i++) {
    int x = c[i];
    for (int now = 0; now <= x; now++) {
      int rem = x - now;
      for (int ant = now; ant <= n; ant++) {
        int adding = mul(comb(x, now), comb(ant, now));
        adding = mul(adding, dp[i - 1][ant]);
        adding = mul(adding, fact[now]);
        dp[i][ant - now + rem] = add(dp[i][ant - now + rem], adding);
      }
    }
  }
  cout << dp[y][0] << "\n";
  return 0;
  for (int i = 1; i <= y; i++) {
    int x = c[i];
    cout << x << " ";
    for (int rem = 0; rem <= x; rem++) {
      for (int ant = x - rem; ant <= n; ant++) {
        dp[i][ant - (x - rem) + rem] =
            add(dp[i][ant - (x - rem) + rem],
                mul(dp[i - 1][ant], mul(comb(ant, x - rem), comb(x, rem))));
      }
    }
  }
  for (int i = 1; i <= y; i++) {
    for (int j = 0; j <= n; j++) {
      if (dp[i][j]) {
        cout << i << ", " << j << " : " << dp[i][j] << "\n";
      }
    }
    cout << "\n";
  }
  cout << dp[y][0] << "\n";
}
