#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <atcoder/all>

// g++-10 f.cpp -std=c++17 -I .

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

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

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll cnt[100100],fc[100100]={1ll},nv[100100]={1ll},calc[55555]={1ll};
std::vector<ll> v,u;

ll c(int n, int k){
	ll ret = fc[n];
	mul_mod(ret,nv[k]);
	mul_mod(ret,nv[n-k]);
	return ret;
}

int main(void){
	int n,i,m,j,t,h;
	ll ans=0ll;
	scanf("%d",&n);
	m = n*2; v.push_back(1ll);
	v.reserve(n);
	u.reserve(n);
	for(i=1; i<=100000; ++i){
		fc[i] = fc[i-1]*i%MOD;
		nv[i] = atcoder::inv_mod(fc[i],MOD);
	}
	for(i=1; i<=n; ++i){
		calc[i] = calc[i-1]*(i*2-1)%MOD;
	}
	for(i=0; i<m; ++i){
		scanf("%d",&h); --h;
		++cnt[h];
	}
	for(i=0; i<100000; ++i){
		if(cnt[i]<2){
			continue;
		}
		for(j=0; j<=cnt[i]; j+=2){
			u.push_back(c(cnt[i],j)*calc[(j>>1)]%MOD);
		}
		v = atcoder::convolution<MOD>(v,u);
		u.clear();
	}
	std::reverse(calc,calc+n+1);
	for(i=0; i<v.l_ength(); ++i){
		// std::cout << calc[i] << " " << v[i] << std::endl;
		if(i&1){
			add_mod(ans,MOD-(calc[i]*v[i])%MOD);
		}else{
			add_mod(ans,calc[i]*v[i]%MOD);
		}
	}
	printf("%lld\n",ans);
	return 0;
}
