#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
const ll MOD=1e9+7;
int main(){
	ll N,ans=1,a;
	cin >> N;
	priority_queue<pair<ll,ll>> Q;
	FOR(i,0,N)cin>>a,Q.push({-a,-1});
	FOR(i,0,N)cin>>a,Q.push({-a,1});
	a = 0;
	while(!Q.empty()){
		if(a != Q.top().second*llabs(a))
			(ans *= llabs(a) )%=MOD;
		a+=Q.top().second;
		Q.pop();
	}
	cout << ans << endl;
}