#include <algorithm>
#include <atcoder/all>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define PRIM 3
#define INF (1 << 29)
#define LINF (1LL << 60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

using mint = atcoder::modint998244353;

int cnt[110000];
mint factorial[220000];
mint inv_factorial[220000];
mint perfect[220000];
mint two_pow[220000];
vector<vector<mint>> polynomials[220000];

mint nCk(int n, int k)
{
    if (k < 0 || n < k)
        return 0;
    return factorial[n] * inv_factorial[k] * inv_factorial[n - k];
}

int main()
{
    factorial[0] = 1;
    perfect[0] = 1;
    two_pow[0] = 1;
    for (int i = 1; i < 220000; i++) {
        factorial[i] = factorial[i - 1] * i;
        perfect[i] = perfect[i - 1] * (2 * i - 1);
        two_pow[i] = two_pow[i - 1] * 2;
    }
    inv_factorial[220000 - 1] = factorial[220000 - 1].inv();
    for (int i = 220000 - 1; i > 0; i--) {
        inv_factorial[i - 1] = inv_factorial[i] * i;
    }

    int n;
    cin >> n;
    for (int i = 0; i < n * 2; i++) {
        int h;
        cin >> h;
        cnt[h]++;
    }
    mint odd = 0, even = 1;

    for (int h = 0; h < 110000; h++) {
        int c = cnt[h];
        if (c == 0)
            continue;
        vector<mint> polynomial;
        for (int k = 0; k * 2 <= c; k++) {
            polynomial.push_back(nCk(c, 2 * k) * perfect[k]);
        }
        polynomials[polynomial.size()].push_back(polynomial);
    }

    vector<mint> poly;
    for (int d = 2; d <= n; d++) {
        for (int i = 0; i < polynomials[d].size(); i++) {

            if (poly.empty())
                poly = polynomials[d][i];
            else {
                auto new_poly = atcoder::convolution(poly, polynomials[d][i]);
                polynomials[new_poly.size()].push_back(move(new_poly));
                poly.clear();
            }
        }
    }
    mint ans = 0;
    for (int i = 0; i < poly.size(); i++) {
        mint cnt = poly[i] * perfect[n - i];
        if (i % 2 == 0)
            ans += cnt;
        else
            ans -= cnt;
    }
    cout << ans.val() << endl;
}