#ifdef ONLINE_JUDGE
#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using i128 = __int128_t;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
constexpr char ln = '\n';
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) {if (a < b) {a = b; return true;} return false;}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) {if (a > b) {a = b; return true;} return false;}
inline int topbit(int x) {return x == 0 ? -1 : 31-__builtin_clz(x);}
inline int topbit(long long x) {return x == 0 ? -1 : 63-__builtin_clzll(x);}
inline int botbit(int x) {return x == 0 ? 32 : __builtin_ctz(x);}
inline int botbit(long long x) {return x == 0 ? 64 : __builtin_ctzll(x);}
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
inline int kthbit(long long x, int k) {return (x>>k)&1;}
inline void print() {cout << "\n";}
template<class T>
inline void print(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
    print();
}
template<class T, class... Args>
inline void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
#ifdef MINATO_LOCAL
#define dump(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
inline void debug() {cerr << endl;}
template<class T>
inline void debug(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cerr << *itr << " ";
    debug();
}
template<class T, class... Args>
inline void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
#else
#define dump(x) void(0)
inline void debug() {}
template<class T> inline void debug(const vector<T> &v) {}
template<class T, class... Args> inline void debug(const T &x, const Args &... args) {}
#endif
struct Fast_ios {Fast_ios() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);};} fast_ios;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


struct ModCombination {
    vector<mint> Fac,Facinv;

    ModCombination(int x) {
        Fac.resize(x+1);
        Facinv.resize(x+1);
        Fac[0] = 1;
        for (int i = 0; i < x; ++i) Fac[i+1] = Fac[i]*(i+1);
        Facinv[x] = Fac[0]/Fac[x];
        for (int i = x; i > 0; --i) Facinv[i-1] = Facinv[i]*i;
    }

    mint get(int n, int k) {
        if (k < 0 || k > n) return 0;
        return Fac[n]*Facinv[k]*Facinv[n-k];
    }
};

const int MAX = 100000;
int main() {
    int N; cin >> N;
    vector<int> cnt(MAX);
    ModCombination MC(1000000);
    rep(i,N*2) {
        int h; cin >> h;
        h--;
        cnt[h]++;
    }

    sort(all(cnt));
    reverse(all(cnt));
    while (cnt.back()==0) cnt.pop_back();
    reverse(all(cnt));
    queue<vector<mint>> que;
    vector<mint> hoge(1000000,1);
    for (int i = 2; i < 1000000; i++) hoge[i] = hoge[i-2]*i;
    for (auto i : cnt) {
        int M = i/2+1;
        vector<mint> arr(M,1);
        for (int j = 1; j < M; j++) {
            arr[j] = MC.get(i,j*2)*hoge[j*2-1];
        }
        que.emplace(arr);
    }

    while (int(que.size()) > 1) {
        auto A = que.front(); que.pop();
        auto B = que.front(); que.pop();
        auto C = convolution(A,B);
        que.emplace(C);
    }

    auto x = que.front(); que.pop();
    mint ans = 0;
    mint b = 1;
    b /= 2;
    rep(i,SZ(x)) {
        x[i] *= i == N ? mint(1) : hoge[N*2-i*2-1];
        if (~i&1) ans += x[i];
        else ans -= x[i];
    }

    cout << ans.val() << ln;
}


Measured memory_bytes: 20816