#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
using namespace std;
typedef pair<int,int>P;
typedef long long ll;

int main(){
	int n;scanf("%d",&n);
	vector<P>v;
	rep(i,n){
		int a;scanf("%d",&a);
		v.push_back(P(a,0));
	}
	rep(i,n){
		int b;scanf("%d",&b);
		v.push_back(P(b,1));
	}
	sort(v.begin(),v.end());
	ll cnt=0,ty=-1;
	ll ans=1;
	for(auto p:v){
		if(ty==!p.second){
			(ans*=cnt)%=MOD;
			cnt--;
			if(cnt==0)ty=-1;
		}
		else{
			cnt++;
			ty=p.second;
		}
	}
	cout<<ans<<endl;
}