#include using namespace std; #define int long long const int mod = 998244353; signed main(){ int n; cin >> n; int x[n],y[n]; for(int i = 0;i < n;i++) cin >> x[i]; for(int i = 0;i < n;i++) cin >> y[i]; sort(x,x + n); sort(y,y + n); reverse(y,y + n); int t = 0; for(int i = 0;i < n;i++){ if(x[i] < y[i])t++; } vector a(n + 1); a[1] = 1; for(int i = 2;i <= n;i++){ a[i] = a[i - 1] * i; a[i] %= mod; } cout << a[t] * a[n - t] % mod << endl; }