#include <bits/stdc++.h>
#include <atcoder/all>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using namespace atcoder;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const long long MOD = 998244353;
ll func(ll x){
  const ll max_len=100001;
  static vector<ll> cache(max_len);
  static bool f=false;
  if(f){
    return cache[x];
  }
  f=true;
  cache[1]=cache[0]=1;
  const ll inv2=inv_mod(2,MOD);
  FOR(i,2,max_len){
    cache[i]=cache[i-2]*i%MOD*(i-1)%MOD*inv2%MOD;
  }
  return cache[x];
}
ll factorial(ll x){
  static vector<ll> cache(1000001);
  static bool f=false;
  if(f){
    return cache[x];
  }
  f=true;
  cache[0]=cache[1]=1;
  FOR(i,2,1000001){
    cache[i]=cache[i-1]*i%MOD;
  }
  return cache[x];
}
void solve(long long N, std::vector<long long> h){
  vector<ll> mp(100000);
  REP(2*N){
    mp[h[i]]++;
  }
  vector<ll> st;
  REP(100000){
    if(mp[i]>1){
      st.push_back(mp[i]);
    }
  }
  deque<vector<ll>> dp;
  for (auto &&i : st)
  {
    vector<ll> tmp{1};
    For(j,i/2){
      tmp.push_back(func(i-2*j));
    }
    dp.push_back(move(tmp));
  }
  while(dp.size()>1){
    dp.push_back(convolution(move(dp[0]),move(dp[1])));
    dp.pop_front();dp.pop_front();
  }
  {
    vector<ll> dp2=move(dp[0]);
    vector<ll> dp=move(dp2);
    ll ans=0;
    REP(dp.size()){
      if(i%2==0){
        ans=(ans+dp[i]*func(2*(N-i))%MOD*inv_mod(factorial(N-i),MOD)%MOD)%MOD;
      }else{
        ans=(ans+MOD-dp[i]*func(2*(N-i))%MOD*inv_mod(factorial(N-i),MOD)%MOD)%MOD;
      }
    }
    cout<<ans<<endl;

  }
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> h(2*N);
    for(int i = 0 ; i < 2*N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, std::move(h));
    return 0;
}
