#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=998244353;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

#define MAX_N 1000010
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){// this size is really ok??
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r);
}

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

ll mod_inverse(ll x){
  return mod_pow(x,MOD-2);
}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

//const ll MOD=998244353; // MOD == 119*2^23+1
//depends on mod_pow,mod_inverse

ll root[24],invroot[24];

void NTT_init(){
    for(int i=0;i<24;++i){
        root[i]=mod_pow(3,(MOD-1)/(1<<i));
        invroot[i]=mod_inverse(root[i]);
    }
}

vector<ll> NTT(vector<ll> a,bool inverse=false){
    int n=a.size();
    int high=0;
    for(int i=0;(1<<i)<n;++i) high++;

    for(int i=0;i<n;++i){
        int mask=0;
        for(int k=0;k<high;++k){
            if(i>>k&1) mask|=(1<<(high-1-k));
        }
        if(i<mask) swap(a[i],a[mask]);
    }

    for(int j=1;(1<<j)<=n;++j){
        int m=(1<<j);
        ll zeta=root[j];
        if(inverse) zeta=invroot[j];
        for(int i=0;i<n;i+=m){
            ll powzeta=1;
            for(int k=i;k<i+m/2;++k){
                ll s=a[k];
                ll t=a[k+m/2]*powzeta%MOD;

                a[k]=(s+t)%MOD;
                a[k+m/2]=(s-t+MOD)%MOD;
                powzeta=powzeta*zeta%MOD;
            }
        }
    }

    if(inverse){
        ll invn=mod_inverse(n);
        for(int i=0;i<n;++i) a[i]=a[i]*invn%MOD;
    }
    return a;
}

vector<ll> convolute(const vector<ll> &a,const vector<ll> &b){
    int size=a.size()+b.size()-1;
    int n=1;
    while(n<size) n<<=1;

    vector<ll> A(n,0),B(n,0);
    for(int i=0;i<a.size();i++) A[i]=a[i];
    for(int i=0;i<b.size();i++) B[i]=b[i];

    A=NTT(A);
    B=NTT(B);

    for(int i=0;i<n;++i) A[i]=A[i]*B[i]%MOD;
    A=NTT(A,true);

    A.resize(size);
    return A;
}

const int L=1e5;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  setComb();
  NTT_init();

  int N;
  cin>>N;
  vector<int> A(2*N);
  rep(i,2*N) cin>>A[i];

  vector<ll> cb(L+1,0);
  cb[0]=1;
  for(int i=2;i<=L;i+=2){
      //cb[i]=comb(i,i/2)%MOD;
      //mul(cb[i],inv[2]);
      cb[i]=comb(i,2)*cb[i-2]%MOD;
  }
  for(int i=2;i<=L;i+=2) mul(cb[i],ifac[i/2]);

  vector<int> num(L+1,0);
  rep(i,2*N) num[A[i]]++;

  for(int i=1;i<=L;i++){
      if(num[i]>N){
          cout<<0<<endl;
          return 0;
      }
  }

  vector<vector<ll>> dp(L+1);
  for(int i=1;i<=L;i++){
      if(num[i]==0) continue;
      vector<ll> tmp(num[i]/2+1,0);
      tmp[0]=1;
      for(int k=1;k<=num[i]/2;k++){
          ll coef=comb(num[i],2*k);
          mul(coef,cb[2*k]);
          tmp[k]=coef;
      }
      dp[i]=tmp;
  }

  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> PQ;
  for(int i=1;i<=L;i++){
      if(num[i]==0) continue;
      PQ.push(mkp(num[i],i));
  }

  while(PQ.size()>=2){
      auto f=PQ.top();
      PQ.pop();
      auto s=PQ.top();
      PQ.pop();

      int ft=f.second;
      int st=s.second;
      dp[ft]=convolute(dp[ft],dp[st]);
      PQ.push(mkp(dp[ft].size(),ft));
      dp[st].clear();
  }
  auto f=PQ.top();
  PQ.pop();
  vector<ll> table=dp[f.second];

  ll ans=cb[2*N];
  for(int i=1;i<=N;i++){
      ll res=0;
      if(i<table.size()) res=table[i];
      mul(res,cb[2*N-2*i]);

      if(i%2) add(ans,MOD-res);
      else add(ans,res);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 40288