#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<pair<ll,ll> > line;
    rep(i,n){
        ll tmp;cin>>tmp;
        line.push_back(make_pair(tmp,0));
    }
    rep(i,n){
        ll tmp;cin>>tmp;
        line.push_back(make_pair(tmp,1));
    }
    sort(line.begin(),line.end());
    ll cnt=0;
    ll state = line[0].second;
    ll res = 1;
    rep(i,2*n){
        if(cnt==0){state=line[i].second;}
        if(state==line[i].second){
            cnt++;
        }else{
            res *= cnt;
            res %= MOD;
            cnt--;
        }
    }
    cout << res << endl;
    return 0;
}
