#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 0
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

// 500, 90min

enum Color {
    Black = 0,
    Red
};
ll N;
vector< pair<ll, ll> > Line;    // first: val, second: color
vector<ll> A;
vector<ll> B;
// fact[i] で i! にアクセス
ll fact[MAX_N];
// fact_inv[i] で 1/i! にアクセス
ll fact_inv[MAX_N];

// x の n 乗 を m で余りをとったもの
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while ( n > 0) {
        if (n & 1) { res = res * x % mod; } // 最下位ビットが立っているときに x^(2^i) を掛ける
        x = x * x % mod;                    // x を順次 2 乗していく
        n >>= 1;
    }
    return res;
}

ll combination(ll n, ll r, ll mod) {
    assert(n <= N);
    assert(r <= n);
    ll ret = (fact[n] * fact_inv[n - r]) % mod;
    ret = (ret * fact_inv[r]) % mod;
    return ret;
}
ll combination(ll n, ll r) {
    return combination(n, r, MOD);
}
ll permutation(ll n, ll r, ll mod) {
    assert(n <= N);
    assert(r <= n);
    return (fact[n] * fact_inv[n - r]) % mod;
}
ll permutation(ll n, ll r) {
    return permutation(n, r, MOD);
}

signed main()
{
    cin >> N;
    REP(i, N) {
        ll tmp;
        cin >> tmp;
        A.push_back(tmp);
    }
    REP(i, N) {
        ll tmp;
        cin >> tmp;
        B.push_back(tmp);
    }
    SORT(A); SORT(B);

    // 0! ～ N! までの階乗を保管する配列の作成 (mod MOD をとってある)
    // O(n)
    // 大体 N <=10^5 && 10^9+7 の mod を求める時に必要になるはず
    fact[0] = 1;
    for(int i = 1; i <= N; ++i) {
        fact[i] = (fact[i-1] * i) % MOD;
    }
    // N! の逆元 1/N! を二分累乗法で求める
    // フェルマーの小定理より a^-1 = a^(p-2) mod p -> (N!)^-1 = (N!)^(p-2) mod p
    fact_inv[N] = mod_pow(fact[N], MOD-2, MOD);
    // 以下 1 / (N-1)! = N / N! であることを利用
    for(int i = N - 1; i >= 0; --i) {
        fact_inv[i] = (fact_inv[i + 1] * (i + 1)) % MOD;
    }

    ll ans = 1;
    // 小さい方を Black にする
    if(A[0] < B[0]) {
        for(auto& a : A) { Line.push_back(make_pair(a, Black)); }
        for(auto& b : B) { Line.push_back(make_pair(b, Red)); }
    } else {
        for(auto& b : B) { Line.push_back(make_pair(b, Black)); }
        for(auto& a : A) { Line.push_back(make_pair(a, Red)); }
    }
    SORT(Line);
    ll b_num = 0, s_num = 0;
    ll head = Black;
    for(auto& p : Line) {
        DBG("%lld %s\n", p.first, (p.second == Black) ? "Black" : "Red");
        if(p.second == head) {
            b_num++;
            if(s_num > 0) {
                DBG("b_num: %lld s_num: %lld\n", b_num-1, s_num);
                ans *= permutation(b_num-1, s_num);
                ans %= MOD;
                b_num -= s_num;
                s_num = 0;
            }
        }
        else {
            s_num++;
            if(s_num > b_num) {
                DBG("b_num: %lld s_num: %lld\n", b_num, s_num-1);
                ans *= permutation(b_num, s_num-1);
                ans %= MOD;
                head = (head == Black) ? Red : Black;
                b_num = 1;
                s_num = 0;
            }
        }
    }
    if(b_num > 0) {
        DBG("b_num: %lld s_num: %lld\n", b_num, s_num);
        ans *= permutation(b_num, s_num);
        ans %= MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 9328