#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, char> P;
vector<P> V;
string str;
ll n, ans;
const ll mod = 1000000007;

void dfs(ll num, ll moji, ll count){
    if (num == str.length()) return;
    if (count == 0){
        dfs(num + 1, str[num] - 'A', count + 1);
    } else {
        if (str[num] - 'A' == moji){
            dfs(num + 1, moji, count + 1);
        } else {
            (ans *= count) %= mod;
            dfs(num + 1, moji, count - 1);
        }
    }
}

int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i < n; i++){
        ll a;
        cin >> a;
        V.push_back(P(a, 'A'));
    }
    for (ll i = 0; i < n; i++){
        ll b;
        cin >> b;
        V.push_back(P(b, 'B'));
    }
    sort(V.begin(), V.end());
    for (ll i = 0; i < V.size(); i++){
        P p = V[i];
        str += p.second;
    }
    ans = 1;
    dfs(0, 0, 0);
    cout << ans << endl;
}
