#include <bits/stdc++.h>
using namespace std;
#ifdef __DEBUG__
    void debug_out() { cerr << endl; } 
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) {cerr << " " << H; debug_out(T...);}
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 
#endif

using ll = long long int;

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#include <atcoder/modint>
#include <atcoder/convolution>
using modint = atcoder::modint998244353;

int N;
vector<int> H;
inline void input(){
    fast_io();
    cin >> N;
    H = fetch_vec<int>(2*N);
}


inline int solve(){
    vector<modint> fact(2*N+1), revfact(2*N+1);
    fact[0] = fact[1] = 1;
    for (int i = 0; i < 2*N; i++) fact[i+1] = fact[i]*(i+1);
    revfact[2*N] = fact[2*N].inv();
    for (int i = 2*N-1; i >= 0; i--) revfact[i] = revfact[i+1]*(i+1);

    // modint ans = fact[2*N]*revfact[N]*modint(2).pow(N).inv();
    map<int, int> cnt;
    for(auto h:H) cnt[h]++;
    vector<ll> nums;
    for(auto [h,c]:cnt) if(c>=2) nums.emplace_back(c);
    int K = nums.size();
    sort(nums.begin(),nums.end());
    deque<vector<modint> > q;
    for (int k = 0; k < K; k++)
    {
        ll n = nums[k];
        vector<modint> tmp;
        for (int i = 0; 2*i <= n; i++)
        {
            tmp.push_back(fact[n]*revfact[i]*revfact[n-2*i]*modint(2).pow(i).inv());
        }
        q.push_back(tmp);
    }
    auto cmp = [](vector<modint> a, vector<modint> b){return a.size() < b.size();};
    sort(q.begin(),q.end(),cmp);

    while(q.size()>1){
        vector<modint> c = atcoder::convolution(q[0], q[1]);
        q.push_back(c);
        q.pop_front();
        q.pop_front();
    }
    
    vector<modint> d = q.front();
    modint ans = 0;
    for (int k = 0; k <= K; k++)
    {
        modint ans_k = 0;
        ans_k = d[k]*fact[2*N-2*k]*revfact[N-k]*modint(2).pow(N-k).inv();
        if(k%2) ans -= ans_k;
        else ans += ans_k;
    }
    cout << ans.val() << "\n";
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}
