#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,a,b;
    cin>>n;
    vector<pair<int,int>> A;
    rep(i,n) cin>>a,A.push_back(make_pair(a,1));
    rep(i,n) cin>>b,A.push_back(make_pair(b,2));
    sort(A.begin(),A.end());
    ll ans=1,mod=1e9+7,x=0,y=0;
    rep(i,2*n){
        if(x==0) y=A[i].second,x++;
        else{
            if(y==A[i].second) x++;
            else ans=ans*x%mod,x--;
        }
    }
    cout<<ans;
}