#ifdef DEBUG #define _GLIBCXX_DEBUG #else #pragma GCC target("avx2") #pragma GCC optimize("Ofast,unroll-loops") #endif #include #include #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define ALL(a) a.begin(), a.end() #define vec vector #undef long #define long long long #define ll long using namespace std; using mint = atcoder::modint998244353; ostream& operator<<(ostream& os, mint a) { return os << a.val(); } template ostream& operator<<(ostream& os, vector& a) { const int n = a.size(); rep(i, n) os << a[i] << " \n"[i + 1 == n]; return os; } template ostream& operator<<(ostream& os, array& a) { rep(i, n) os << a[i] << " \n"[i + 1 == n]; return os; } template istream& operator>>(istream& is, vector& a) { for (T& i : a) is >> i; return is; } template bool chmin(T& x, T y) { if (x > y) { x = y; return true; } return false; } template bool chmax(T& x, T y) { if (x < y) { x = y; return true; } return false; } void solve() { int n; cin >> n; const int n2 = n << 1; vec x(n2); rep(j, 2) rep(i, n) { int val; cin >> val; x[i + n * j] = 2 * val + j; } sort(ALL(x)); int odd = 0; rep(i, n) odd += x[i] & 1; mint ans = 1; rep(i, odd) ans *= i + 1; rep(i, n - odd) ans *= i + 1; cout << ans << endl; } int main() { // srand((unsigned)time(NULL)); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(40); solve(); return 0; }