#include <iostream>
#include <vector>
#include <list>
#include <atcoder/convolution>
using namespace std;
using namespace atcoder;

long long powmod(long long a, long long b, long long m)
{
    long long r = 1;
    for (; b>0; b>>=1, a=a*a%m)
        if (b&1)
            r = r*a%m;
    return r;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin>>N;
    vector<int> h(2*N);
    for (int &a: h)
    {
        cin>>a;
        a--;
    }

    vector<int> C(100000);
    for (int a: h)
        C[a]++;

    long long M = 998244353;
    vector<long long> F(2*N+1);
    F[0] = 1;
    for (int i=1; i<=2*N; i++)
        F[i] = F[i-1]*i%M;

    vector<long long> FF(2*N+1);
    FF[0] = FF[1] = 1;
    for (int i=2; i<=2*N; i++)
        FF[i] = FF[i-2]*i%M;

    list<vector<long long>> T;
    for (int c: C)
        if (c>0)
        {
            vector<long long> A(c/2+1);
            for (int i=0; i*2<=c; i++)
                A[i] = F[c]*powmod(F[i*2], M-2, M)%M*powmod(F[c-i*2], M-2, M)%M * (i==0 ? 1 : FF[2*i-1]) % M;
            T.push_back(A);
        }

    while (T.size()>1)
    {
        vector<long long> A = T.front();
        T.pop_front();
        vector<long long> B = T.front();
        T.pop_front();
        vector<long long> C = convolution(A, B);
        T.push_back(C);
    }

    vector<long long> A = T.front();
    for (int i=0; i<(int)A.size(); i++)
        A[i] = A[i]*(N*2-2*i-1 >= 0 ? FF[N*2-2*i-1] : 1)%M;

    long long ans = 0;
    for (int i=0; i<(int)A.size(); i++)
        ans = (ans + A[i]*(1-2*(i&1)))%M;
    cout<<ans<<endl;
}
