#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1000000007;
ll gyaku(ll n){
  ll y=mod-2;
  ll now=n;
  ll ret=1;
  while(y>0){
    if(y%2==1)ret*=now;
    now*=now;
    ret%=mod;
    now%=mod;
    y/=2;
  }
  return ret;
}
ll nck(ll n,ll k){
  if(2*k>n)k=n-k;
  ll ret=1;
  for(ll i=0;i<k;i++){
    ret*=n-i;
    ret%=mod;
    ret*=gyaku(i+1);
    ret%=mod;
  }
  return ret;
}
int main(){
  ll n;cin>>n;
  vector<pll> v;
  ll a[n],b[n];
  ll kai[100001];
  kai[0]=1;
  for(ll i=0;i<n;i++){
    cin>>a[i];
    v.push_back(make_pair(a[i],(ll)0));
  }
  for(ll i=0;i<n;i++){
    cin>>b[i];
    v.push_back(make_pair(b[i],(ll)1));
  }
  sort(v.begin(),v.end());
  for(ll i=1;i<=100000;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=mod;
  }
  ll ans=1;
  ll c[2];
  c[0]=0;c[1]=0;
  for(ll i=0;i<v.size();i++){
    ll t=v[i].second;
    ll s=(t+1)%2;
    c[t]++;
    if(c[t]>c[s]&&c[s]>0){
      ans*=nck(c[t]-1,c[s]);
      ans%=mod;
      ans*=kai[c[s]];
      ans%=mod;
      c[t]-=c[s];
      c[s]=0;
    }
   // cout<<c[0]<<" "<<c[1]<<endl;
  }
  ans*=kai[c[0]];
  ans%=mod;
  cout<<ans<<endl;
}
                