#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
const ll MOD=1e9+7;

ll tim(ll a, ll b){
	return (a*b)%MOD;
}


int main(){
	int N;
	cin>>N;
	priority_queue<P> q;
	rep(i,N){
		int a;
      	cin>>a;
		q.push(make_pair(a,1));
	}
	rep(i,N){
		int a;
      	cin>>a;
		q.push(make_pair(a,-1));
	}
	
	ll dif=0;
	ll ans=1;
	while(!q.empty()){
		P p=q.top();
		q.pop();
		ll f=(ll)p.second;
		if(dif==0)dif+=f;
		else if(dif>0){
			if(f==1)dif++;
			else{
				ans=tim(ans, dif);
				dif--;
			}
		}
		else{
			if(f==-1)dif--;
			else{
				ans=tim(ans, -dif);
				dif++;
			}
		}
	}
	cout<<ans<<endl;
	
}