#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  int N;
  cin>>N;
  vector<pair<int,bool>> v(2*N);
  for(int i=0;i<2*N;i++){
    int x;
    cin>>x;
    bool y=(i<N);
    v[i]={x,y};
  }
  sort(v.begin(),v.end());
  ll ans=1;
  int cnt=0;
  for(int i=0;i<2*N;i++){
    int tmp=cnt+(v[i].second?1:-1);
    if(abs(tmp)<abs(cnt)) (ans*=cnt)%=MOD;
    cnt=tmp;
  }
  cout<<abs(ans)<<endl;
  return 0;
}
