#include<iostream>
#include<queue>
#include<cassert>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    priority_queue<pair<int,int>> pq;
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        pq.push({-x, 1});
    }
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        pq.push({-x, -1});
    }
    ll ans = 1, balance = 0;
    while(!pq.empty()){
        pair<int,int> p = pq.top(); pq.pop();
        int i = p.second;
        if(i*(balance) < 0){
            ans *= abs(balance);
            ans %= mod;
        }
        balance += i;
    }
    assert(balance==0);
    cout << ans << endl;
    return 0;
}