#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; const int mod = 998244353; int N; mint ff[101010], fi[101010]; void solve(){ cin >> N; vector> a; for(int i = 0;i < N;i++){ int x; cin >> x; a.push_back({x, 0}); } for(int i = 0;i < N;i++){ int y; cin >> y; a.push_back({y, 1}); } sort(a.begin(), a.end(), greater> {}); int cnt[2] = {}; for(int i = 0;i < N;i++){ cnt[a[i].second]++; } cout << (ff[cnt[0]] * ff[cnt[1]]).val() << endl; } int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); ff[0] = fi[0] = 1; for(int i = 1;i <= 100000;i++){ ff[i] = ff[i - 1] * i; fi[i] = ff[i].inv(); } solve(); return 0; }