#include #include #include #define int long long using namespace std; typedef pair P; int n; int x[100000], y[100000]; int fact(int n, int mod) { int ret = 1; for (int i = 1; i <= n; i++) { ret *= i; ret %= mod; } return ret; } signed main() { int i; cin >> n; for (i = 0; i < n; i++) cin >> x[i]; for (i = 0; i < n; i++) cin >> y[i]; vector

pa; //(座標, 色) for (i = 0; i < n; i++) pa.push_back(P(x[i], 0)); for (i = 0; i < n; i++) pa.push_back(P(y[i], 1)); sort(pa.begin(), pa.end()); int black = 0; for (i = 0; i < n; i++) if (pa[i].second == 0) black++; int mod = 998244353; cout << fact(black, mod) * fact(n - black, mod) % mod << endl; return 0; }