#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 998244353;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <u32 M>
struct modint {
    u32 val;
public:
    static modint raw(int v) { modint x; x.val = v; return x; }
    modint() : val(0) {}
    template <class T>
    modint(T v) { ll x = (ll)(v%(ll)(M)); if (x < 0) x += M; val = u32(x); }
    modint(bool v) { val = ((unsigned int)(v) % M); }
    modint& operator++() { val++; if (val == M) val = 0; return *this; }
    modint& operator--() { if (val == 0) val = M; val--; return *this; }
    modint operator++(int) { modint result = *this; ++*this; return result; }
    modint operator--(int) { modint result = *this; --*this; return result; }
    modint& operator+=(const modint& b) { val += b.val; if (val >= M) val -= M; return *this; }
    modint& operator-=(const modint& b) { val -= b.val; if (val >= M) val += M; return *this; }
    modint& operator*=(const modint& b) { u64 z = val; z *= b.val; val = (u32)(z % M); return *this; }
    modint& operator/=(const modint& b) { return *this = *this * b.inv(); }
    modint operator+() const { return *this; }
    modint operator-() const { return modint() - *this; }
    modint pow(long long n) const { modint x = *this, r = 1; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
    modint inv() const { return pow(M-2); }
    friend modint operator+(const modint& a, const modint& b) { return modint(a) += b; }
    friend modint operator-(const modint& a, const modint& b) { return modint(a) -= b; }
    friend modint operator*(const modint& a, const modint& b) { return modint(a) *= b; }
    friend modint operator/(const modint& a, const modint& b) { return modint(a) /= b; }
    friend bool operator==(const modint& a, const modint& b) { return a.val == b.val; }
    friend bool operator!=(const modint& a, const modint& b) { return a.val != b.val; }
};
using mint = modint<MOD>;
class Factorial {
    vector<mint> facts, factinv;
public:
    explicit Factorial(int n) : facts(n+1), factinv(n+1) {
        facts[0] = 1;
        for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1] * mint(i);
        factinv[n] = facts[n].inv();
        for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * mint(i+1);
    }
    mint fact(int k) const {
        if(k >= 0) return facts[k]; else return factinv[-k];
    }
    mint operator[](const int &k) const {
        if(k >= 0) return facts[k]; else return factinv[-k];
    }
    mint C(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return facts[p] * factinv[q] * factinv[p-q];
    }
    mint P(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return facts[p] * factinv[p-q];
    }
    mint H(int p, int q) const {
        if(p < 0 || q < 0) return 0;
        return q == 0 ? 1 : C(p+q-1, q);
    }
};

constexpr int ntt_mod = 998244353, ntt_root = 3;

class NTT {
    static constexpr int max_base = 20, maxN = 1 << max_base; // N <= 524288 * 2
    mint sum_e[30], sum_ie[30];

public:
    mint es[30], ies[30];
    NTT() {
        int cnt2 = __builtin_ctz(ntt_mod-1);

        mint e = mint(ntt_root).pow((ntt_mod-1) >> cnt2), ie = e.inv();
        for (int i = cnt2; i >= 0; i--){
            es[i] = e;
            ies[i] = ie;
            e *= e;
            ie *= ie;
        }
        mint now = 1, nowi = 1;
        for (int i = 0; i < cnt2 - 2; i++) {
            sum_e[i] = es[i+2] * now;
            now *= ies[i+2];
            sum_ie[i] = ies[i+2] * nowi;
            nowi *= es[i+2];
        }
    }

    void transform(vector<mint> &a, int sign){
        const int n = a.size();
        int h = 0;
        while ((1U << h) < (unsigned int)(n)) h++;
        if(!sign){ // fft
            for (int ph = 1; ph <= h; ph++) {
                int w = 1 << (ph-1), p = 1 << (h-ph);
                mint now = 1;
                for (int s = 0; s < w; s++) {
                    int offset = s << (h-ph+1);
                    for (int i = 0; i < p; i++) {
                        auto l = a[i+offset], r = a[i+offset+p]*now;
                        a[i+offset] = l+r;
                        a[i+offset+p] = l-r;
                    }
                    now *= sum_e[__builtin_ctz(~(unsigned int)(s))];
                }
            }
        }else { // ifft
            for (int ph = h; ph >= 1; ph--) {
                int w = 1 << (ph-1), p = 1 << (h-ph);
                mint inow = 1;
                for (int s = 0; s < w; s++) {
                    int offset = s << (h-ph+1);
                    for (int i = 0; i < p; i++) {
                        auto l = a[i+offset], r = a[i+offset+p];
                        a[i+offset] = l+r;
                        a[i+offset+p] = (l-r)*inow;
                    }
                    inow *= sum_ie[__builtin_ctz(~(unsigned int)(s))];
                }
            }
        }
    }
};

NTT ntt;

struct poly {
    vector<mint> v;
    poly() = default;
    explicit poly(int n) : v(n) {};
    explicit poly(vector<mint> vv) : v(std::move(vv)) {};
    int size() const {return (int)v.size(); }
    poly cut(int len){
        if(len < v.size()) v.resize(static_cast<unsigned long>(len));
        return *this;
    }
    inline mint& operator[] (int i) {return v[i]; }
    poly& operator+=(const poly &a) {
        this->v.resize(max(size(), a.size()));
        for (int i = 0; i < a.size(); ++i) this->v[i] += a.v[i];
        return *this;
    }
    poly& operator-=(const poly &a) {
        this->v.resize(max(size(), a.size()));
        for (int i = 0; i < a.size(); ++i) this->v[i] -= a.v[i];
        return *this;
    }

    poly& operator*=(poly a) {
        int N = size()+a.size()-1;
        int sz = 1;
        while(sz < N) sz <<= 1;
        this->v.resize(sz); a.v.resize(sz);
        ntt.transform(this->v, 0); ntt.transform(a.v, 0);
        for(int i = 0; i < sz; ++i) this->v[i] *= a.v[i];
        ntt.transform(this->v, 1);
        this->v.resize(N);
        mint iz = mint(sz).inv();
        for (int i = 0; i < N; i++) this->v[i] *= iz;
        return *this;
    }
    poly& operator/=(const poly &a){ return (*this *= a.inv()); }
    poly operator+(const poly &a) const { return poly(*this) += a; }
    poly operator-(const poly &a) const { return poly(*this) -= a; }
    poly operator*(const poly &a) const { return poly(*this) *= a; }

    poly inv() const {
        int n = size();
        poly r(1);
        r[0] = (this->v[0]).inv();
        int k = 1;
        while(k < n){
            k *= 2;
            poly ff(k);
            for (int i = 0; i < min(k, n); ++i) {
                ff[i] = this->v[i];
            }
            poly nr = (r*r*ff).cut(k);
            for (int i = 0; i < k/2; ++i) {
                nr[i] = (r[i]+r[i]-nr[i]);
                nr[i+k/2] = -nr[i+k/2];
            }
            r = nr;
        }
        r.v.resize(n);
        return r;
    }
};

mint nth_term(poly p, poly q, ll n){
    if(!n) return p[0]/q[0];
    int sz = 1, h = 0;
    int k = max(p.size(), q.size());
    while(sz < 2*k-1) sz <<= 1, h++;
    p.v.resize(sz); q.v.resize(sz);
    mint x = mint(sz>>1).inv();
    vector<mint> y(sz>>1, 0);
    for (int j = sz>>2, i = h; j; j >>= 1, i--) y[j] = ntt.ies[i];
    y[0] = 1;
    for (int i = 2; i < sz>>1; i <<= 1) {
        for (int j = i+1; j < 2*i; ++j) {
            y[j] = y[j-i]*y[i];
        }
    }
    ntt.transform(p.v, 0);
    ntt.transform(q.v, 0);
    poly tmp(sz>>1);
    auto up = [&](poly &A){
        for (int i = 0; i < sz>>1; ++i) tmp[i] = A[i];
        ntt.transform(tmp.v, 1);
        mint now = x;
        for (int i = 0; i < sz>>1; ++i) tmp[i] *= now, now *= ntt.es[h];
        ntt.transform(tmp.v, 0);
        for (int i = 0; i < sz>>1; ++i) A[i|(sz>>1)] = tmp[i];
    };
    int ika = h;
    while(n){
        for (int i = 0; i < sz; ++i) p[i] *= q[i^1];
        if(n&1) for (int i = 0; i < sz>>1; ++i) p[i] = (p[i<<1]-p[(i<<1)|1])*y[i];
        else for (int i = 0; i < sz>>1; ++i) p[i] = (p[i<<1]+p[(i<<1)|1]);
        ika++;
        if(n == 1) break;
        up(p);
        for (int i = 0; i < sz>>1; ++i) q[i] = q[i<<1]*q[(i<<1)|1];
        up(q);
        n >>= 1;
    }
    for (int i = 0; i < sz>>1; ++i) tmp[i] = p[i];
    ntt.transform(tmp.v, 1);
    return mint(2).pow(ntt_mod-ika)*tmp[0];
}

template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;


int main() {
    int n;
    cin >> n;
    vector<int> v(2*n);
    vector<int> cnt(100001);
    for (auto &&i : v) scanf("%d", &i), cnt[i]++;
    vector<poly> ps;
    Factorial f(200001);
    for (int i = 0; i <= 100000; ++i) {
        if(!cnt[i]) continue;
        poly a(cnt[i]/2+1);
        mint val = 1;
        for (int j = 0; j <= cnt[i]/2; ++j) {
            a[j] = val*f[-j];
            val *= f.C(cnt[i]-j*2, 2);
        }
        ps.emplace_back(a);
    }
    auto fff = [&](int x, int y){ return ps[x].size() > ps[y].size();};
    priority_queue<int, vector<int>, decltype(fff)> Q(fff);
    for (int i = 0; i < ps.size(); ++i) {
        Q.emplace(i);
    }
    while(Q.size() >= 2){
        int a = Q.top(); Q.pop();
        int b = Q.top(); Q.pop();
        ps.emplace_back(ps[a]*ps[b]);
        Q.emplace(ps.size()-1);
    }
    auto &&e = ps.back();
    mint ans = 0;
    for (int i = 0; i < e.size(); ++i) {
        int t = 2*n-2*i;
        if(i&1) ans -= e[i]*f[t]*f[-t/2]*(mint(499122177).pow(t/2));
        else ans += e[i]*f[t]*f[-t/2]*(mint(499122177).pow(t/2));
    }
    cout << ans.val << "\n";
    return 0;
}

Measured memory_bytes: 16932